OSDN Git Service

2003-12-17 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Dec 2003 10:16:03 +0000 (10:16 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Dec 2003 10:16:03 +0000 (10:16 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74738 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/performance/container_benchmark.cc
libstdc++-v3/testsuite/performance/ifstream_extract_int.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/list_create_fill_sort.cc
libstdc++-v3/testsuite/testsuite_performance.h

index 59734c5..3381bec 100644 (file)
@@ -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.
index b20376e..4e54374 100644 (file)
@@ -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 (file)
index 0000000..b6ff6c4
--- /dev/null
@@ -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;
+};
index ee3ff33..8999b43 100644 (file)
@@ -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;
index a736fcf..f70e527 100644 (file)
@@ -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();