]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.14
authorfred <fred>
Sun, 24 Mar 2002 19:57:25 +0000 (19:57 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:57:25 +0000 (19:57 +0000)
flower/NEWS
flower/VERSION
flower/include/cpu-timer.hh [new file with mode: 0644]
lily/break.cc
lily/word-wrap.cc

index a53c1a47516b0eb44483c312c1e8f421d149b5a9..7d080f2cd13402e24205ebbeef06d9b62b98eba0 100644 (file)
@@ -1,3 +1,5 @@
+pl 30
+       - Cpu_timer
 pl 29 
        - Dictionary_iter, Dictionary
 
index da049c7e3ce08c50392011a1bae57291b64c4284..ab5a2361a9cb0749631f15c124c270b4e7d13b3f 100644 (file)
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 1
 MINOR_VERSION = 1
-PATCH_LEVEL = 28
+PATCH_LEVEL = 30
 # use to send patches, always empty for released version:
 MY_PATCH_LEVEL = # include separator: "-1" or ".a"
 #
diff --git a/flower/include/cpu-timer.hh b/flower/include/cpu-timer.hh
new file mode 100644 (file)
index 0000000..3205c42
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+  cpu-timer.hh -- declare Cpu_timer
+
+  source file of the Flower Library
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CPU_TIMER_HH
+#define CPU_TIMER_HH
+
+#include <time.h>
+#include "real.hh"
+
+class Cpu_timer {
+  clock_t start_clock_;
+public:
+  Cpu_timer ();
+  void restart ();
+  Real read ();
+};
+
+#endif // CPU_TIMER_HH
index 7f5139a831cf183e000918246d0cd60f0c1ab618..5ee9de0a0ba03311c66c3803c55c4779fbfe860a 100644 (file)
@@ -14,6 +14,7 @@
 #include "scoreline.hh"
 #include "p-score.hh"
 #include "p-col.hh"
+#include "cpu-timer.hh"
 
 String
 Col_stats::str() const { 
@@ -163,7 +164,17 @@ Break_algorithm::OK() const
 Array<Col_hpositions>
 Break_algorithm::solve() const
 {
-  return do_solve();
+  Cpu_timer timer;
+
+  Array<Col_hpositions> h= do_solve();
+  
+  if (approx_stats_.count_i_)
+    *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
+  if (exact_stats_.count_i_)
+    *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
+  *mlog << "Time: " << String(timer.read (), "%.2f") << " seconds\n";
+  
+  return h;
 }
 
 void
@@ -172,11 +183,3 @@ Break_algorithm::do_set_pscore()
   
 }
 
-void
-Break_algorithm::print_stats() const
-{
-  if (approx_stats_.count_i_)
-    *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
-  if (exact_stats_.count_i_)
-    *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
-}
index 5814012ca0b7f1de924335e30571e52b93f7568f..5f61be35d3364aaf82ae03708d84f48bffded8c0 100644 (file)
@@ -101,7 +101,6 @@ Word_wrap::do_solve() const
       *mlog << "[" <<break_idx_i<<"]"<<flush;
       breaking.push (minimum);
     }
-  print_stats();
   return breaking;
 }