mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
Add some mainloop instrumentation
Add trace points around adding, removing and dispatching of sources. https://bugzilla.gnome.org/show_bug.cgi?id=710741
This commit is contained in:
parent
91dd70cf17
commit
a9d93ca1df
@ -82,3 +82,25 @@ probe glib.slice_free = process("@ABS_GLIB_RUNTIME_LIBDIR@/libglib-2.0.so.0.@LT_
|
||||
n_bytes = $arg2;
|
||||
probestr = sprintf("glib.slice_free(n_bytes=%d) -> %p", n_bytes, mem);
|
||||
}
|
||||
|
||||
/**
|
||||
* * probe glib.main_before_dispatch - Called before dispatching a GSource
|
||||
* * @source: name of the source
|
||||
* * @callback: address of the callback
|
||||
* */
|
||||
probe glib.main_before_dispatch = process("@ABS_GLIB_RUNTIME_LIBDIR@/libglib-2.0.so.0.@LT_CURRENT@.@LT_REVISION@").mark("main__before_dispatch")
|
||||
{
|
||||
source = user_string2($arg1, "unnamed");
|
||||
probestr = sprintf("glib.main_before_dispatch(source=%s)", source);
|
||||
}
|
||||
|
||||
/**
|
||||
* * probe glib.main_after_dispatch - Called after dispatching a GSource
|
||||
* * @source: name of the source
|
||||
* * @callback: address of the callback
|
||||
* */
|
||||
probe glib.main_after_dispatch = process("@ABS_GLIB_RUNTIME_LIBDIR@/libglib-2.0.so.0.@LT_CURRENT@.@LT_REVISION@").mark("main__after_dispatch")
|
||||
{
|
||||
source = user_string2($arg1, "unnamed");
|
||||
probestr = sprintf("glib.main_after_dispatch(source=%s)", source);
|
||||
}
|
||||
|
@ -5,4 +5,8 @@ provider glib {
|
||||
probe slice__alloc(void*, unsigned int);
|
||||
probe slice__free(void*, unsigned int);
|
||||
probe quark__new(char *, unsigned int);
|
||||
probe main__before_dispatch (char *);
|
||||
probe main__after_dispatch (char *);
|
||||
probe main__source_attach(char*);
|
||||
probe main__source_destroy(char*);
|
||||
};
|
||||
|
@ -73,6 +73,8 @@
|
||||
#include <windows.h>
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
#include "glib_trace.h"
|
||||
|
||||
#include "gmain.h"
|
||||
|
||||
#include "garray.h"
|
||||
@ -1165,6 +1167,8 @@ g_source_attach (GSource *source,
|
||||
g_return_val_if_fail (source->context == NULL, 0);
|
||||
g_return_val_if_fail (!SOURCE_DESTROYED (source), 0);
|
||||
|
||||
TRACE (GLIB_MAIN_SOURCE_ATTACH (g_source_get_name (source)));
|
||||
|
||||
if (!context)
|
||||
context = g_main_context_default ();
|
||||
|
||||
@ -1182,6 +1186,8 @@ g_source_destroy_internal (GSource *source,
|
||||
GMainContext *context,
|
||||
gboolean have_lock)
|
||||
{
|
||||
TRACE (GLIB_MAIN_SOURCE_DESTROY (g_source_get_name (source)));
|
||||
|
||||
if (!have_lock)
|
||||
LOCK_CONTEXT (context);
|
||||
|
||||
@ -3058,7 +3064,9 @@ g_main_dispatch (GMainContext *context)
|
||||
current->source = source;
|
||||
current->depth++;
|
||||
|
||||
TRACE( GLIB_MAIN_BEFORE_DISPATCH (g_source_get_name (source)));
|
||||
need_destroy = !(* dispatch) (source, callback, user_data);
|
||||
TRACE( GLIB_MAIN_AFTER_DISPATCH (g_source_get_name (source)));
|
||||
|
||||
current->source = prev_source;
|
||||
current->depth--;
|
||||
|
Loading…
Reference in New Issue
Block a user