[glib] glib: Add SystemTap probe to g_source_add_child_source()



commit 6014039cd16295126e8e3a6b77eaa374a07d2345
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Sep 23 22:46:30 2016 -0700

    glib: Add SystemTap probe to g_source_add_child_source()
    
    So that the relationships between parent and child GSources can be
    probed using SystemTap.

 glib/glib.stp.in   |   12 ++++++++++++
 glib/glib_probes.d |    1 +
 glib/gmain.c       |    2 ++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/glib/glib.stp.in b/glib/glib.stp.in
index fd831ea..032a698 100644
--- a/glib/glib.stp.in
+++ b/glib/glib.stp.in
@@ -548,6 +548,18 @@ probe glib.source_set_priority = process("@ABS_GLIB_RUNTIME_LIBDIR@/libglib-2.0.
 }
 
 /**
+ * probe glib.source_add_child_source - Called when a child #GSource is added to another
+ * @source: the parent #GSource
+ * @child_source: the child #GSource
+ */
+probe glib.source_add_child_source = 
process("@ABS_GLIB_RUNTIME_LIBDIR@/libglib-2.0.so.0.@LT_CURRENT@.@LT_REVISION@").mark("source__add_child_source")
+{
+  source = $arg1;
+  child_source = $arg2;
+  probestr = sprintf("glib.source_add_child_source(%p, %p)", source, child_source);
+}
+
+/**
  * probe glib.source_set_name - Called when the name is set for a #GSource
  * @source: the #GSource
  * @name: the new name
diff --git a/glib/glib_probes.d b/glib/glib_probes.d
index 553f7bd..29f7ff1 100644
--- a/glib/glib_probes.d
+++ b/glib/glib_probes.d
@@ -39,6 +39,7 @@ provider glib {
        probe source__set_callback_indirect(void*, void*, void*, void*, void*);
        probe source__set_ready_time(void*, unsigned int);
        probe source__set_priority(void*, void*, unsigned int);
+       probe source__add_child_source(void*, void*);
        probe source__set_name(void*, const char*);
        probe source__before_free(void*, void*, void*);
        probe thread__spawned(void*, void*, char*);
diff --git a/glib/gmain.c b/glib/gmain.c
index 454f5bf..4f90574 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1461,6 +1461,8 @@ g_source_add_child_source (GSource *source,
   if (context)
     LOCK_CONTEXT (context);
 
+  TRACE (GLIB_SOURCE_ADD_CHILD_SOURCE (source, child_source));
+
   source->priv->child_sources = g_slist_prepend (source->priv->child_sources,
                                                 g_source_ref (child_source));
   child_source->priv->parent_source = source;


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