From cbf22cc5497ea2d590f4c7fff3a8617f656de145 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 17 Dec 2003 10:16:03 +0000 Subject: [PATCH] container_benchmark.cc: Tweak outputs. 2003-12-17 Paolo Carlini * 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 --- libstdc++-v3/ChangeLog | 11 ++++ .../performance/container_benchmark.cc | 6 +- .../performance/ifstream_extract_int.cc | 57 +++++++++++++++++++ .../performance/list_create_fill_sort.cc | 2 +- .../testsuite/testsuite_performance.h | 6 +- 5 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 libstdc++-v3/testsuite/performance/ifstream_extract_int.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 59734c5db95..3381bec6120 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2003-12-17 Paolo Carlini + + * 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 * configure.ac (AM_INIT_AUTOMAKE): Don't warn about GNU Make. diff --git a/libstdc++-v3/testsuite/performance/container_benchmark.cc b/libstdc++-v3/testsuite/performance/container_benchmark.cc index b20376eac7d..4e54374575d 100644 --- a/libstdc++-v3/testsuite/performance/container_benchmark.cc +++ b/libstdc++-v3/testsuite/performance/container_benchmark.cc @@ -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}; diff --git a/libstdc++-v3/testsuite/performance/ifstream_extract_int.cc b/libstdc++-v3/testsuite/performance/ifstream_extract_int.cc new file mode 100644 index 00000000000..b6ff6c47603 --- /dev/null +++ b/libstdc++-v3/testsuite/performance/ifstream_extract_int.cc @@ -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 +#include + +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; +}; diff --git a/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc b/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc index ee3ff3369d6..8999b43c53f 100644 --- a/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc +++ b/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc @@ -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; diff --git a/libstdc++-v3/testsuite/testsuite_performance.h b/libstdc++-v3/testsuite/testsuite_performance.h index a736fcf90cd..f70e5274af6 100644 --- a/libstdc++-v3/testsuite/testsuite_performance.h +++ b/libstdc++-v3/testsuite/testsuite_performance.h @@ -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();