summaryrefslogtreecommitdiff
path: root/src/lib/timer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-08-12 10:52:45 +0200
committerCarl Hetherington <cth@carlh.net>2020-09-13 20:22:44 +0200
commitf842d02dba8873e66b6f4fe1cd5d96d5c78a62fd (patch)
tree95558c1ad57ba5cffeea487e5a65e3b0d405555f /src/lib/timer.cc
parentf5f14a6422ddd68a52dd14686c1bd49159dbaa74 (diff)
wip: more or less plays BT@ER (Flat) at full resolution with
about 130% CPU on i7-7700 CPU @ 3.60GHz, Quadro K1200. No XYZ -> RGB colour transform yet.
Diffstat (limited to 'src/lib/timer.cc')
-rw-r--r--src/lib/timer.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/timer.cc b/src/lib/timer.cc
index e4e7bdfdc..7518b5ddc 100644
--- a/src/lib/timer.cc
+++ b/src/lib/timer.cc
@@ -25,6 +25,7 @@
#include "timer.h"
#include "util.h"
#include "compose.hpp"
+#include <boost/thread.hpp>
#include <iostream>
#include <sys/time.h>
@@ -134,3 +135,19 @@ StateTimer::~StateTimer ()
cout << N_("\t") << i->second << "\n";
}
}
+
+
+void timestamped_printf (char const* format, ...)
+{
+ static boost::mutex mutex;
+ boost::mutex::scoped_lock lm (mutex);
+
+ va_list arg;
+ va_start (arg, format);
+ struct timeval t;
+ gettimeofday (&t, 0);
+ printf("%.4f ", seconds(t));
+ vfprintf (stdout, format, arg);
+ va_end (arg);
+}
+