[gnome-builder] build: add support for --enable-profiling



commit 25d4d126289595366a255c7ca9f16484b3be4052
Author: Christian Hergert <christian hergert me>
Date:   Wed May 20 22:11:45 2015 -0700

    build: add support for --enable-profiling
    
              ** Note: This is not a profiler for Builder **
    
    By enabling this, you can use the resulting gmon.out from running Builder
    with `make run` to generate runtime statistics. gprof is one example.
    
     gprof src/.libs/gnome-builder gmon.out > analysis.txt

 configure.ac |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b258972..3b263f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,6 +333,25 @@ AC_SUBST(SHM_LIB)
 
 
 dnl ***********************************************************************
+dnl Check if we should instrument our targets
+dnl ***********************************************************************
+AC_MSG_CHECKING([for --enable-profiling])
+AC_ARG_ENABLE(profiling,
+              AC_HELP_STRING([--enable-profiling],
+                             [turn on runtime instrumentation [default=no]]),
+              [enable_profiling=$enableval])
+AS_IF([test "$enable_profiling" = "yes"],[
+       ac_save_cflags="$CFLAGS"
+       CFLAGS="$CFLAGS -pg"
+       AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+                      [PROFILING_CFLAGS="-pg"],
+                      [enable_profiling=no])
+       CFLAGS="$ac_save_cflags $PROFILING_CFLAGS"
+])
+AC_MSG_RESULT([$enable_profiling])
+
+
+dnl ***********************************************************************
 dnl Process .in Files
 dnl ***********************************************************************
 AC_CONFIG_FILES([
@@ -391,6 +410,7 @@ echo " Development Options"
 echo ""
 echo "  Enable Debug ......................... : ${enable_debug}"
 echo "  Enable Tracing ....................... : ${enable_tracing}"
+echo "  Enable Profiling (-pg)................ : ${enable_profiling}"
 echo "  Build Test Suite ..................... : ${enable_tests}"
 echo "  Build API reference .................. : ${enable_gtk_doc}"
 echo "  Use cross-referencing in API docs .... : ${enable_doc_cross_references}"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]