From 5402074c533534d15e5bf7423fa554160bac50c6 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 4 Jun 2019 15:10:51 -0700 Subject: [PATCH] tools: add --gnome-shell option to sysprof-cli This can be used to connect to newer GNOME Shell versions that have profiling integrated. --- src/tools/sysprof-cli.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c index f1e86f05..29c03f59 100644 --- a/src/tools/sysprof-cli.c +++ b/src/tools/sysprof-cli.c @@ -85,6 +85,7 @@ main (gint argc, gboolean version = FALSE; gboolean force = FALSE; gboolean use_trace_fd = FALSE; + gboolean gnome_shell = FALSE; int pid = -1; int fd; int flags; @@ -97,6 +98,7 @@ main (gint argc, { "no-memory", 0, 0, G_OPTION_ARG_NONE, &no_memory, N_("Disable recording of memory statistics") }, { "use-trace-fd", 0, 0, G_OPTION_ARG_NONE, &use_trace_fd, N_("Set SYSPROF_TRACE_FD environment for subprocess") }, { "gjs", 0, 0, G_OPTION_ARG_NONE, &gjs, N_("Set GJS_TRACE_FD environment to trace GJS processes") }, + { "gnome-shell", 0, 0, G_OPTION_ARG_NONE, &gnome_shell, N_("Connect to org.gnome.Shell for profiler statistics") }, { "version", 0, 0, G_OPTION_ARG_NONE, &version, N_("Print the sysprof-cli version and exit") }, { NULL } }; @@ -258,6 +260,15 @@ main (gint argc, g_object_unref (source); } + if (gnome_shell) + { + source = sysprof_proxy_source_new (G_BUS_TYPE_SESSION, + "org.gnome.Shell", + "/org/gnome/Sysprof3/Profiler"); + sysprof_profiler_add_source (profiler, source); + g_object_unref (source); + } + if (pid != -1) { sysprof_profiler_set_whole_system (profiler, FALSE);