mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-02 16:23:56 +08:00
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
This commit is contained in:
parent
b50d9339ba
commit
cbf22cc549
@ -1,3 +1,14 @@
|
||||
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>
|
||||
|
||||
* 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,
|
||||
|
||||
// test the containers:
|
||||
ostringstream oss;
|
||||
oss << "size = " << size;
|
||||
oss << "size = " << size << " :";
|
||||
report_header(__FILE__, oss.str());
|
||||
for (int i = 0; i < ntests; ++i)
|
||||
{
|
||||
@ -163,8 +163,8 @@ int main()
|
||||
&vector_iterator_test, &deque_test,
|
||||
&list_test, &set_test, &multiset_test };
|
||||
const int ntests = sizeof(tests) / sizeof(test);
|
||||
const char* names[ntests] = { "array", "vector (ptr)",
|
||||
"vector (iter)", "deque",
|
||||
const char* names[ntests] = { "array", "vector (pointer)",
|
||||
"vector (iterator)", "deque",
|
||||
"list", "set", "multiset" };
|
||||
|
||||
const int sizes[] = {100, 1000, 10000, 100000};
|
||||
|
57
libstdc++-v3/testsuite/performance/ifstream_extract_int.cc
Normal file
57
libstdc++-v3/testsuite/performance/ifstream_extract_int.cc
Normal file
@ -0,0 +1,57 @@
|
||||
// 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()
|
||||
}
|
||||
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);
|
||||
}
|
||||
return 0;
|
||||
|
@ -185,13 +185,13 @@ namespace __gnu_test
|
||||
|
||||
out.setf(std::ios_base::left);
|
||||
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 << std::setw(4) << t.real_time() << "r" << space;
|
||||
out << std::setw(4) << t.user_time() << "u" << 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::endl;
|
||||
@ -211,7 +211,7 @@ namespace __gnu_test
|
||||
|
||||
out.setf(std::ios_base::left);
|
||||
out << std::setw(25) << testname << tab;
|
||||
out << std::setw(25) << header << tab;
|
||||
out << std::setw(40) << header << tab;
|
||||
|
||||
out << std::endl;
|
||||
out.close();
|
||||
|
Loading…
Reference in New Issue
Block a user