[sysprof] tools: add --rapl to sysprof-cli command



commit 753a698563f46e7b863b4e0108a00337d4031d72
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 8 16:12:26 2019 -0700

    tools: add --rapl to sysprof-cli command
    
    This allows recording energy statistics using turbostat if supported by
    the host system.

 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 563e2e7..daf2ca7 100644
--- a/src/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -93,6 +93,7 @@ main (gint   argc,
   gboolean force = FALSE;
   gboolean use_trace_fd = FALSE;
   gboolean gnome_shell = FALSE;
+  gboolean rapl = FALSE;
   int pid = -1;
   int fd;
   int flags;
@@ -110,6 +111,7 @@ main (gint   argc,
     { "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") },
     { "gtk", 0, 0, G_OPTION_ARG_NONE, &gtk, N_("Set GTK_TRACE_FD environment to trace a GTK application") },
+    { "rapl", 0, 0, G_OPTION_ARG_NONE, &rapl, N_("Include RAPL energy statistics") },
     { "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 }
@@ -330,6 +332,15 @@ main (gint   argc,
       g_object_unref (source);
     }
 
+  if (rapl)
+    {
+      source = sysprof_proxy_source_new (G_BUS_TYPE_SYSTEM,
+                                         "org.gnome.Sysprof3",
+                                         "/org/gnome/Sysprof3/RAPL");
+      sysprof_profiler_add_source (profiler, source);
+      g_object_unref (source);
+    }
+
   if (!no_network)
     {
       source = sysprof_netdev_source_new ();


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