lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6073] Print only observed time, not relative error


From: Greg Chicares
Subject: [lmi-commits] [6073] Print only observed time, not relative error
Date: Mon, 15 Dec 2014 12:50:11 +0000

Revision: 6073
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6073
Author:   chicares
Date:     2014-12-15 12:50:10 +0000 (Mon, 15 Dec 2014)
Log Message:
-----------
Print only observed time, not relative error

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/wx_test_benchmark_census.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-12-15 12:39:27 UTC (rev 6072)
+++ lmi/trunk/ChangeLog 2014-12-15 12:50:10 UTC (rev 6073)
@@ -34887,3 +34887,9 @@
 Add '--gui_test_path'. See:
   http://lists.nongnu.org/archive/html/lmi/2014-12/msg00068.html
 
+20141215T1250Z <address@hidden> [516]
+
+  wx_test_benchmark_census.cpp
+Print only observed time, not relative error. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-12/msg00073.html
+

Modified: lmi/trunk/wx_test_benchmark_census.cpp
===================================================================
--- lmi/trunk/wx_test_benchmark_census.cpp      2014-12-15 12:39:27 UTC (rev 
6072)
+++ lmi/trunk/wx_test_benchmark_census.cpp      2014-12-15 12:50:10 UTC (rev 
6073)
@@ -31,7 +31,6 @@
 #include "wx_test_statusbar.hpp"
 #include "uncopyable_lmi.hpp"
 
-#include <wx/confbase.h>
 #include <wx/dialog.h>
 #include <wx/frame.h>
 #include <wx/log.h>
@@ -39,6 +38,8 @@
 #include <wx/testing.h>
 #include <wx/uiaction.h>
 
+#include <boost/filesystem/operations.hpp>
+
 #include <cmath>                        // std::fabs()
 
 namespace
@@ -48,22 +49,21 @@
     :private lmi::uncopyable<census_benchmark>
 {
   public:
-    explicit census_benchmark(wxString const& name, wxString const& path)
+    explicit census_benchmark(fs::path const& path)
         :status_(get_main_window_statusbar())
-        ,name_(name)
+        ,name_(path.leaf())
         {
         wxUIActionSimulator z;
         z.Char('o', wxMOD_CONTROL); // "File|Open"
         wxTEST_DIALOG
             (wxYield()
-            ,wxExpectModal<wxFileDialog>(path)
+            ,wxExpectModal<wxFileDialog>(path.native_file_string())
             );
         wxYield();
         }
 
     void time_operation
         (char const* operation
-        ,long time_expected
         ,char key
         ,int mod
         )
@@ -82,41 +82,11 @@
         long time_real;
         LMI_ASSERT(ms_text.ToLong(&time_real));
 
-        // Compare the difference with the expected time if it's specified.
-        wxString delta;
-        if (time_expected)
-            {
-            double const diff_in_percents =
-                100*(time_real - time_expected)
-                    / static_cast<double>(time_expected);
-
-            delta.Printf("%+.2f%%", diff_in_percents);
-
-            LMI_ASSERT_WITH_MSG
-                (std::fabs(diff_in_percents) < 10
-                ,wxString::Format
-                    (
-                    "%s for %s was expected to take %ldms, "
-                    "but actually took %ldms, i.e. %s"
-                    ,operation
-                    ,name_
-                    ,time_expected
-                    ,time_real
-                    ,delta
-                    )
-                );
-            }
-        else
-            {
-            delta = "not specified";
-            }
-
         wxLogMessage
-            ("%s for %s: %ldms elapsed (expected %s)"
+            ("%s for %s: %ldms elapsed"
             ,operation
             ,name_
             ,time_real
-            ,delta
             );
         }
 
@@ -139,15 +109,6 @@
 
 } // Unnamed namespace.
 
-// ERASE THIS BLOCK COMMENT WHEN IMPLEMENTATION COMPLETE. The block
-// comment below changes the original specification, and does not
-// yet describe the present code. Desired changes:
-//  - use "gui_test_path/MSEC*.cns", not a config file list
-//  - write timings to stdout only; perform no relative-error
-//    calculation, and do not use times stored in a config file
-// With these changes, the test should no longer use the config file
-// in any way.
-
 /// Measure the speed of various operations on certain census files.
 ///
 /// Comparing the results of this test to a stored touchstone makes it
@@ -176,29 +137,23 @@
 
 LMI_WX_TEST_CASE(benchmark_census)
 {
-    wxConfigBase const& c = config();
+    fs::directory_iterator const end_i;
+    for(fs::directory_iterator i(get_test_files_path()); i != end_i; ++i)
+        {
+        if(!wxString(i->leaf()).Matches("MSEC*.cns"))
+            {
+            continue;
+            }
 
-    // Read the timing parameters.
-    long const time_run = c.ReadLong("time_run", 0);
-    long const time_disk = c.ReadLong("time_disk", 0);
-    long const time_spreadsheet = c.ReadLong("time_spreadsheet", 0);
+        census_benchmark b(*i);
 
-    // The censuses to benchmark are specified by the subgroups of the config
-    // file, so iterate over all of them.
-    wxString name;
-    long z;
-    for(bool ok = c.GetFirstGroup(name, z); ok; ok = c.GetNextGroup(name, z))
         {
-        census_benchmark b(name, c.Read(name + "/path"));
-
-        {
         // Ensure that the window doesn't stay opened (and possibly affects
         // negatively the subsequent tests) even if this test fails.
         wxON_BLOCK_EXIT_OBJ0(b, census_benchmark::close_window);
 
         b.time_operation
             ("Run case"
-            ,time_run
             ,'r'
             ,wxMOD_CONTROL | wxMOD_SHIFT
             );
@@ -206,14 +161,12 @@
 
         b.time_operation
             ("Print case to PDF"
-            ,time_disk
             ,'i'
             ,wxMOD_CONTROL | wxMOD_SHIFT
             );
 
         b.time_operation
             ("Print case to spreadsheet"
-            ,time_spreadsheet
             ,'h'
             ,wxMOD_CONTROL | wxMOD_SHIFT
             );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]