summaryrefslogtreecommitdiff
path: root/trunk/src/backend/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/backend/debug.h')
-rw-r--r--trunk/src/backend/debug.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/trunk/src/backend/debug.h b/trunk/src/backend/debug.h
new file mode 100644
index 000000000..26fb16856
--- /dev/null
+++ b/trunk/src/backend/debug.h
@@ -0,0 +1,38 @@
+#ifndef __TOTEM_DEBUG_H__
+#define __TOTEM_DEBUG_H__ 1
+
+#ifdef GNOME_ENABLE_DEBUG
+
+#include <sys/time.h>
+
+#ifdef G_HAVE_ISO_VARARGS
+#define D(...) g_message (__VA_ARGS__)
+#else
+#define D(x...) g_message (x)
+#endif
+#define TE() { g_message ("enter %s", __PRETTY_FUNCTION__ ); gdk_threads_enter (); }
+#define TL() { g_message ("leave %s", __PRETTY_FUNCTION__); gdk_threads_leave (); }
+#define TOTEM_PROFILE(function) \
+ do{ \
+ struct timeval current_time; \
+ double dtime; \
+ gettimeofday(&current_time, NULL); \
+ dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \
+ function; \
+ gettimeofday(&current_time, NULL); \
+ dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \
+ printf("(%s:%d) took %lf seconds\n", \
+ __PRETTY_FUNCTION__, __LINE__, dtime ); \
+ }while(0)
+#else
+#ifdef G_HAVE_ISO_VARARGS
+#define D(...)
+#else
+#define D(x...)
+#endif
+#define TE() { gdk_threads_enter (); }
+#define TL() { gdk_threads_leave (); }
+#define TOTEM_PROFILE(function) function
+#endif
+
+#endif /* __TOTEM_DEBUG_H__ */