--- /dev/null
+/*
+ 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
#include "scoreline.hh"
#include "p-score.hh"
#include "p-col.hh"
+#include "cpu-timer.hh"
String
Col_stats::str() 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
}
-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";
-}