From 1e13cc4a97b0848836319adbe5e682fc72c783a2 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:57:25 +0000 Subject: [PATCH] lilypond-0.1.14 --- flower/NEWS | 2 ++ flower/VERSION | 2 +- flower/include/cpu-timer.hh | 24 ++++++++++++++++++++++++ lily/break.cc | 21 ++++++++++++--------- lily/word-wrap.cc | 1 - 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 flower/include/cpu-timer.hh diff --git a/flower/NEWS b/flower/NEWS index a53c1a4751..7d080f2cd1 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,5 @@ +pl 30 + - Cpu_timer pl 29 - Dictionary_iter, Dictionary diff --git a/flower/VERSION b/flower/VERSION index da049c7e3c..ab5a2361a9 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -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 index 0000000000..3205c42b35 --- /dev/null +++ b/flower/include/cpu-timer.hh @@ -0,0 +1,24 @@ +/* + cpu-timer.hh -- declare Cpu_timer + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef CPU_TIMER_HH +#define CPU_TIMER_HH + +#include +#include "real.hh" + +class Cpu_timer { + clock_t start_clock_; +public: + Cpu_timer (); + void restart (); + Real read (); +}; + +#endif // CPU_TIMER_HH diff --git a/lily/break.cc b/lily/break.cc index 7f5139a831..5ee9de0a0b 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -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 Break_algorithm::solve() const { - return do_solve(); + Cpu_timer timer; + + Array 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"; -} diff --git a/lily/word-wrap.cc b/lily/word-wrap.cc index 5814012ca0..5f61be35d3 100644 --- a/lily/word-wrap.cc +++ b/lily/word-wrap.cc @@ -101,7 +101,6 @@ Word_wrap::do_solve() const *mlog << "[" <