Commit cbf22cc5 by Paolo Carlini Committed by Paolo Carlini

container_benchmark.cc: Tweak outputs.

2003-12-17  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/performance/container_benchmark.cc: Tweak outputs.

	* testsuite/performance/list_create_fill_sort.cc: Shrink a
	bit some outputs.

	* testsuite/testsuite_performance.h: Widen a few output fields.

	* testsuite/performance/ifstream_extract_int.cc: New.

From-SVN: r74738
parent b50d9339
2003-12-17 Paolo Carlini <pcarlini@suse.de>
* testsuite/performance/container_benchmark.cc: Tweak outputs.
* testsuite/performance/list_create_fill_sort.cc: Shrink a
bit some outputs.
* testsuite/testsuite_performance.h: Widen a few output fields.
* testsuite/performance/ifstream_extract_int.cc: New.
2003-12-16 Phil Edwards <phil@codesourcery.com> 2003-12-16 Phil Edwards <phil@codesourcery.com>
* configure.ac (AM_INIT_AUTOMAKE): Don't warn about GNU Make. * configure.ac (AM_INIT_AUTOMAKE): Don't warn about GNU Make.
......
...@@ -144,7 +144,7 @@ void run_tests(int size, const test* tests, const char** names, ...@@ -144,7 +144,7 @@ void run_tests(int size, const test* tests, const char** names,
// test the containers: // test the containers:
ostringstream oss; ostringstream oss;
oss << "size = " << size; oss << "size = " << size << " :";
report_header(__FILE__, oss.str()); report_header(__FILE__, oss.str());
for (int i = 0; i < ntests; ++i) for (int i = 0; i < ntests; ++i)
{ {
...@@ -163,8 +163,8 @@ int main() ...@@ -163,8 +163,8 @@ int main()
&vector_iterator_test, &deque_test, &vector_iterator_test, &deque_test,
&list_test, &set_test, &multiset_test }; &list_test, &set_test, &multiset_test };
const int ntests = sizeof(tests) / sizeof(test); const int ntests = sizeof(tests) / sizeof(test);
const char* names[ntests] = { "array", "vector (ptr)", const char* names[ntests] = { "array", "vector (pointer)",
"vector (iter)", "deque", "vector (iterator)", "deque",
"list", "set", "multiset" }; "list", "set", "multiset" };
const int sizes[] = {100, 1000, 10000, 100000}; const int sizes[] = {100, 1000, 10000, 100000};
......
// Copyright (C) 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <fstream>
#include <testsuite_performance.h>
int main()
{
using namespace std;
using namespace __gnu_test;
time_counter time;
resource_counter resource;
const int iterations = 10000000;
{
ofstream out("tmp_perf_int.txt");
for (int i = 0; i < iterations; ++i)
out << i << "\n";
}
{
ifstream in("tmp_perf_int.txt");
start_counters(time, resource);
for (int j, i = 0; i < iterations; ++i)
in >> j;
stop_counters(time, resource);
report_performance(__FILE__, "", time, resource);
}
unlink("tmp_perf_int.txt");
return 0;
};
...@@ -57,7 +57,7 @@ int main() ...@@ -57,7 +57,7 @@ int main()
} }
stop_counters(time, resource); stop_counters(time, resource);
sprintf(comment,"Iterations: %8u Size: %8u",iterations,n); sprintf(comment,"Iters: %8u Size: %4u", iterations, n);
report_performance(__FILE__, comment, time, resource); report_performance(__FILE__, comment, time, resource);
} }
return 0; return 0;
......
...@@ -185,13 +185,13 @@ namespace __gnu_test ...@@ -185,13 +185,13 @@ namespace __gnu_test
out.setf(std::ios_base::left); out.setf(std::ios_base::left);
out << std::setw(25) << testname << tab; out << std::setw(25) << testname << tab;
out << std::setw(10) << comment << tab; out << std::setw(25) << comment << tab;
out.setf(std::ios_base::right); out.setf(std::ios_base::right);
out << std::setw(4) << t.real_time() << "r" << space; out << std::setw(4) << t.real_time() << "r" << space;
out << std::setw(4) << t.user_time() << "u" << space; out << std::setw(4) << t.user_time() << "u" << space;
out << std::setw(4) << t.system_time() << "s" << space; out << std::setw(4) << t.system_time() << "s" << space;
out << std::setw(4) << r.allocated_memory() << "mem" << space; out << std::setw(8) << r.allocated_memory() << "mem" << space;
out << std::setw(4) << r.hard_page_fault() << "pf" << space; out << std::setw(4) << r.hard_page_fault() << "pf" << space;
out << std::endl; out << std::endl;
...@@ -211,7 +211,7 @@ namespace __gnu_test ...@@ -211,7 +211,7 @@ namespace __gnu_test
out.setf(std::ios_base::left); out.setf(std::ios_base::left);
out << std::setw(25) << testname << tab; out << std::setw(25) << testname << tab;
out << std::setw(25) << header << tab; out << std::setw(40) << header << tab;
out << std::endl; out << std::endl;
out.close(); out.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment