mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
tools: add --gnome-shell option to sysprof-cli
This can be used to connect to newer GNOME Shell versions that have profiling integrated.
This commit is contained in:
@ -85,6 +85,7 @@ main (gint argc,
|
|||||||
gboolean version = FALSE;
|
gboolean version = FALSE;
|
||||||
gboolean force = FALSE;
|
gboolean force = FALSE;
|
||||||
gboolean use_trace_fd = FALSE;
|
gboolean use_trace_fd = FALSE;
|
||||||
|
gboolean gnome_shell = FALSE;
|
||||||
int pid = -1;
|
int pid = -1;
|
||||||
int fd;
|
int fd;
|
||||||
int flags;
|
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") },
|
{ "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") },
|
{ "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") },
|
{ "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") },
|
{ "version", 0, 0, G_OPTION_ARG_NONE, &version, N_("Print the sysprof-cli version and exit") },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
@ -258,6 +260,15 @@ main (gint argc,
|
|||||||
g_object_unref (source);
|
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)
|
if (pid != -1)
|
||||||
{
|
{
|
||||||
sysprof_profiler_set_whole_system (profiler, FALSE);
|
sysprof_profiler_set_whole_system (profiler, FALSE);
|
||||||
|
|||||||
Reference in New Issue
Block a user