diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2008-07-27 15:42:03 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@src.gnome.org> | 2008-07-27 15:42:03 (GMT) |
commit | 597433bc874ff2cf5cb9f9de4e053db47837e042 (patch) | |
tree | 2143de602b6a0bbd81de36b7b1bca721f4ed67d5 /libdocument/ev-debug.h | |
parent | dc42eeb3da3878a8698c2358658f821819d3d070 (diff) |
Add a profile mode available when debug is enabled. Add profilers in
2008-07-27 Carlos Garcia Campos <carlosgc@gnome.org>
* libdocument/ev-debug.[ch]: (ev_profiler_start),
(ev_profiler_stop):
* shell/ev-jobs.c: (ev_job_finished), (ev_job_links_run),
(notify_page_ready), (ev_job_render_run), (ev_job_thumbnail_run),
(ev_job_fonts_run), (ev_job_load_run), (ev_job_save_run),
(ev_job_print_run):
* shell/main.c: (main):
Add a profile mode available when debug is enabled. Add profilers
in ev-jobs.
svn path=/trunk/; revision=3086
Diffstat (limited to 'libdocument/ev-debug.h')
-rw-r--r-- | libdocument/ev-debug.h | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/libdocument/ev-debug.h b/libdocument/ev-debug.h index b025597..c8b8a34 100644 --- a/libdocument/ev-debug.h +++ b/libdocument/ev-debug.h @@ -35,12 +35,29 @@ #ifndef __EV_DEBUG_H__ #define __EV_DEBUG_H__ -#include <glib.h> +#include <glib-object.h> + +#define EV_GET_TYPE_NAME(instance) g_type_name_from_instance ((gpointer)instance) #ifndef EV_ENABLE_DEBUG + #define ev_debug_init() -#define ev_debug_message(...) -#else +#define ev_debug_shutdown() +#if defined(G_HAVE_GNUC_VARARGS) +#define ev_debug_message(section, format, args...) G_STMT_START { } G_STMT_END +#define ev_profiler_start(format, args...) G_STMT_START { } G_STMT_END +#define ev_profiler_stop(format, args...) G_STMT_START { } G_STMT_END +#elif defined(G_HAVE_ISO_VARARGS) +#define ev_debug_message(...) G_STMT_START { } G_STMT_END +#define ev_profiler_start(...) G_STMT_START { } G_STMT_END +#define ev_profiler_stop(...) G_STMT_START { } G_STMT_END +#else /* no varargs macros */ +static void ev_debug_message(EvDebugSection section, const gchar *file, gint line, const gchar *function, const gchar *format, ...) {} +static void ev_profiler_start(EvProfileSection section, const gchar *format, ...) {} +static void ev_profiler_stop(EvProfileSection section, const gchar *format, ...) {} +#endif + +#else /* ENABLE_DEBUG */ G_BEGIN_DECLS @@ -54,17 +71,30 @@ typedef enum { EV_DEBUG_JOBS = 1 << 0 } EvDebugSection; +#define DEBUG_JOBS EV_DEBUG_JOBS, __FILE__, __LINE__, G_STRFUNC -#define DEBUG_JOBS EV_DEBUG_JOBS, __FILE__, __LINE__, G_STRFUNC - -void ev_debug_init (void); +/* + * Set an environmental var of the same name to turn on + * profiling. Setting EV_PROFILE will turn on all + * sections. + */ +typedef enum { + EV_NO_PROFILE = 0, + EV_PROFILE_JOBS = 1 << 0 +} EvProfileSection; -void ev_debug_message (EvDebugSection section, - const gchar *file, - gint line, - const gchar *function, - const gchar *format, ...) G_GNUC_PRINTF(5, 6); +void ev_debug_init (void); +void ev_debug_shutdown (void); +void ev_debug_message (EvDebugSection section, + const gchar *file, + gint line, + const gchar *function, + const gchar *format, ...) G_GNUC_PRINTF(5, 6); +void ev_profiler_start (EvProfileSection section, + const gchar *format, ...) G_GNUC_PRINTF(2, 3); +void ev_profiler_stop (EvProfileSection section, + const gchar *format, ...) G_GNUC_PRINTF(2, 3); G_END_DECLS |