[sysprof] tools: add --gnome-shell option to sysprof-cli



commit 5402074c533534d15e5bf7423fa554160bac50c6
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 4 15:10:51 2019 -0700

    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 f1e86f0..29c03f5 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);


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