[gtk/tracing: 24/30] Add a way to start the profiler



commit e1d239496812e32185800218da8b8a30cb36d02c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 19 19:42:11 2018 +0100

    Add a way to start the profiler
    
    If SYSPROF_TRACE_FD is set in the environment,
    interpret it as an fd to write profiling data
    to.
    
    If GTK_TRACE is set, write profiling data
    to a file with name gtk.$PID.syscap.

 gdk/gdk.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 29acab5415..bc03cbad99 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -26,6 +26,7 @@
 
 #include "gdkversionmacros.h"
 
+#include "gdkprofilerprivate.h"
 #include "gdkinternals.h"
 #include "gdkintl.h"
 
@@ -211,6 +212,11 @@ gdk_pre_parse (void)
       _gdk_debug_flags = g_parse_debug_string (debug_string,
                                               (GDebugKey *) gdk_debug_keys,
                                               G_N_ELEMENTS (gdk_debug_keys));
+
+    if (g_getenv ("SYSPROF_TRACE_FD"))
+      gdk_profiler_start (atoi (g_getenv ("SYSPROF_TRACE_FD")));
+    else if (g_getenv ("GTK_TRACE"))
+      gdk_profiler_start (-1);
   }
 #endif  /* G_ENABLE_DEBUG */
 


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