libsysprof: add support for dbus messages as a document type

This commit is contained in:
Christian Hergert
2023-07-27 12:21:58 -07:00
parent f46d690a28
commit 8dd2d3d73c
10 changed files with 750 additions and 0 deletions

View File

@ -84,6 +84,12 @@ main (int argc,
else if (SYSPROF_IS_DOCUMENT_JITMAP (frame))
g_print (" n_jitmaps=%u",
sysprof_document_jitmap_get_size (SYSPROF_DOCUMENT_JITMAP (frame)));
else if (SYSPROF_IS_DOCUMENT_DBUS_MESSAGE (frame))
g_print (" message-length=%u serial=0x%x sender=%s destination=%s",
sysprof_document_dbus_message_get_message_length (SYSPROF_DOCUMENT_DBUS_MESSAGE (frame)),
sysprof_document_dbus_message_get_serial (SYSPROF_DOCUMENT_DBUS_MESSAGE (frame)),
sysprof_document_dbus_message_get_sender (SYSPROF_DOCUMENT_DBUS_MESSAGE (frame)),
sysprof_document_dbus_message_get_destination (SYSPROF_DOCUMENT_DBUS_MESSAGE (frame)));
else if (SYSPROF_IS_DOCUMENT_CTRDEF (frame))
{
guint n_counters = sysprof_document_ctrdef_get_n_counters (SYSPROF_DOCUMENT_CTRDEF (frame));

View File

@ -32,6 +32,8 @@ static gboolean memprof;
static gboolean tracer;
static gboolean gnome_shell;
static gboolean bundle_symbols;
static gboolean session_bus;
static gboolean system_bus;
static char *power_profile;
static const GOptionEntry entries[] = {
{ "capture", 'c', 0, G_OPTION_ARG_FILENAME, &capture_file, "The file to capture into", "CAPTURE" },
@ -39,6 +41,8 @@ static const GOptionEntry entries[] = {
{ "tracer", 't', 0, G_OPTION_ARG_NONE, &tracer, "Enable tracing with __cyg_profile_enter" },
{ "gnome-shell", 's', 0, G_OPTION_ARG_NONE, &gnome_shell, "Request GNOME Shell to provide profiler data" },
{ "power-profile", 'p', 0, G_OPTION_ARG_STRING, &power_profile, "Use POWER_PROFILE for duration of recording", "power-saver|balanced|performance" },
{ "session-bus", 0, 0, G_OPTION_ARG_NONE, &session_bus, "Record D-Bus messages on the session bus" },
{ "system-bus", 0, 0, G_OPTION_ARG_NONE, &system_bus, "Record D-Bus messages on the system bus" },
{ "bundle-symbols", 'b', 0, G_OPTION_ARG_STRING, &bundle_symbols, "Bundle synbols with the capture" },
{ 0 }
};
@ -201,6 +205,12 @@ main (int argc,
else
sysprof_profiler_add_instrument (profiler, sysprof_sampler_new ());
if (session_bus)
sysprof_profiler_add_instrument (profiler, sysprof_dbus_monitor_new (G_BUS_TYPE_SESSION));
if (system_bus)
sysprof_profiler_add_instrument (profiler, sysprof_dbus_monitor_new (G_BUS_TYPE_SYSTEM));
for (int i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--") == 0 && i+1 < argc)