From a951f1a240d5c5908679a02296002f0783767122 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 26 Jun 2019 14:22:09 -0700 Subject: [PATCH] tools: record network stats from sysprof-cli --- src/tools/sysprof-cli.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c index fc5261f1..75d624ea 100644 --- a/src/tools/sysprof-cli.c +++ b/src/tools/sysprof-cli.c @@ -79,9 +79,10 @@ main (gint argc, GError *error = NULL; gchar *command = NULL; gboolean gjs = FALSE; - gboolean no_memory = FALSE; gboolean no_cpu = FALSE; gboolean no_decode = FALSE; + gboolean no_memory = FALSE; + gboolean no_network = FALSE; gboolean no_perf = FALSE; gboolean version = FALSE; gboolean force = FALSE; @@ -98,6 +99,7 @@ main (gint argc, { "no-perf", 0, 0, G_OPTION_ARG_NONE, &no_perf, N_("Do not record stacktraces using Linux perf") }, { "no-decode", 0, 0, G_OPTION_ARG_NONE, &no_decode, N_("Do not append symbol name information from local machine") }, { "no-memory", 0, 0, G_OPTION_ARG_NONE, &no_memory, N_("Disable recording of memory statistics") }, + { "no-network", 0, 0, G_OPTION_ARG_NONE, &no_network, N_("Disable recording of network 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") }, @@ -267,6 +269,13 @@ main (gint argc, g_object_unref (source); } + if (!no_network) + { + source = sysprof_netdev_source_new (); + sysprof_profiler_add_source (profiler, source); + g_object_unref (source); + } + if (gnome_shell) { source = sysprof_proxy_source_new (G_BUS_TYPE_SESSION,