summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-11-06 22:54:39 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2012-11-06 22:54:39 +0000
commit6e771e4c49b6f50c3053fa5eb14fc08b98e9eddc (patch)
tree35603a2482ff9d0f7396cbc093bd862200875cf0
parenteafd52f784b62b931dcaff6a59d3b009ae9c9b47 (diff)
downloadlibrufl-6e771e4c49b6f50c3053fa5eb14fc08b98e9eddc.tar.gz
librufl-6e771e4c49b6f50c3053fa5eb14fc08b98e9eddc.tar.bz2
Add times to debug output.
-rw-r--r--src/rufl_internal.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/rufl_internal.h b/src/rufl_internal.h
index 1c01e36..7801178 100644
--- a/src/rufl_internal.h
+++ b/src/rufl_internal.h
@@ -186,9 +186,22 @@ extern const size_t rufl_glyph_map_size;
#ifdef __CC_NORCROFT
#define __PRETTY_FUNCTION__ __func__
#endif
-#define LOG(format, ...) (fprintf(stderr, __FILE__ " %s %i: ", \
- __PRETTY_FUNCTION__, __LINE__), fprintf(stderr, format, \
- __VA_ARGS__), fprintf(stderr, "\n"))
+#include <time.h>
+bool log_got_start_time;
+time_t log_start_time;
+#define LOG(format, ...) \
+ do { \
+ if (log_got_start_time == false) { \
+ log_start_time = time(NULL); \
+ log_got_start_time = true; \
+ } \
+ \
+ fprintf(stderr,"(%.6fs) " __FILE__ " %s %i: ", \
+ difftime(time(NULL), log_start_time), \
+ __PRETTY_FUNCTION__, __LINE__); \
+ fprintf(stderr, format, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ } while (0)
#else
#define LOG(format, ...) ((void) 0)
#endif