From 800f5e6d6e864bc6f120416927d30f6f5adda9ff Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 13 Jun 2011 10:30:49 +0100 Subject: [PATCH] profile: Adds a --enable-profile option This adds a --enable-profile option which enables uprof based profiling. It was also necessary to fixup a CLUTTER_ENABLE_PROFILING #ifdef in cogl-context.c to renamed COGL_ENABLE_PROFILING instead. By default Cogl doesn't output uprof reports directly, instead it assumes a higher level toolkit will output a report. If you want a report from Cogl you can export COGL_PROFILE_OUTPUT_REPORT=1 before running your app. The latest version of uprof can be fetched from: git://github.com/rib/UProf.git --- cogl/Makefile.am | 2 +- cogl/cogl-context.c | 2 +- configure.ac | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/cogl/Makefile.am b/cogl/Makefile.am index c3e2d72a7..2e501d9c1 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -379,7 +379,7 @@ libcogl_la_LDFLAGS = \ -no-undefined \ -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ -export-dynamic \ - -export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_foreach_sub_texture_in_region|_cogl_atlas_texture_new_with_size).*" + -export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_foreach_sub_texture_in_region|_cogl_atlas_texture_new_with_size|_cogl_profile_trace_message).*" libcogl_la_SOURCES = $(cogl_sources_c) nodist_libcogl_la_SOURCES = $(BUILT_SOURCES) diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c index 6abdfccf4..bb8e5b1ed 100644 --- a/cogl/cogl-context.c +++ b/cogl/cogl-context.c @@ -111,7 +111,7 @@ cogl_context_new (CoglDisplay *display, const CoglWinsysVtable *winsys; int i; -#ifdef CLUTTER_ENABLE_PROFILE +#ifdef COGL_ENABLE_PROFILE /* We need to be absolutely sure that uprof has been initialized * before calling _cogl_uprof_init. uprof_init (NULL, NULL) * will be a NOP if it has been initialized but it will also diff --git a/configure.ac b/configure.ac index 42bbbf445..314e6847f 100644 --- a/configure.ac +++ b/configure.ac @@ -209,6 +209,29 @@ AS_IF([test "x$enable_cairo" = "xyes" && test "x$enable_debug" = "xyes"], ]) +dnl ============================================================ +dnl Enable profiling +dnl ============================================================ +AC_ARG_ENABLE(profile, + AC_HELP_STRING([--enable-uprof=@<:@no/yes@:>@], + [Turn on uprof profiling support. yes; All UProf profiling probe points are compiled in and may be runtime enabled. no; No profiling support will built into cogl. @<:@default=no@:>@]), + [], + [enable_profile=no]) +AS_IF([test "x$enable_profile" = "xyes"], + [ + AS_IF([test "x$GCC" = "xyes"], + [ + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES uprof-0.3" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_ENABLE_PROFILE" + AS_IF([test "x$enable_debug" = "xyes"], [COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DUPROF_DEBUG"]) + ], + [ + AC_MSG_ERROR([--enable-profile is currently only supported if using GCC]) + ]) + ]) +AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno") + + dnl ============================================================ dnl Enable strict compiler flags dnl ============================================================ @@ -895,6 +918,7 @@ echo " Wayland compositor support: ${enable_wayland_egl_server}" fi echo " Image backend: ${COGL_IMAGE_BACKEND}" echo " Cogl Pango: ${enable_cogl_pango}" +echo " Profiling: ${enable_profile}" # Compiler/Debug related flags echo ""