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
This commit is contained in:
Robert Bragg 2011-06-13 10:30:49 +01:00
parent 44e4b13324
commit 800f5e6d6e
3 changed files with 26 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 ""