[sysprof] tools: record battery from sysprof-cli



commit d44fdb48d940ea8803ed5bc6f5cd59ad41c85fec
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 26 14:26:15 2019 -0700

    tools: record battery from sysprof-cli

 src/tools/sysprof-cli.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c
index 75d624e..384e65f 100644
--- a/src/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -79,6 +79,7 @@ main (gint   argc,
   GError *error = NULL;
   gchar *command = NULL;
   gboolean gjs = FALSE;
+  gboolean no_battery = FALSE;
   gboolean no_cpu = FALSE;
   gboolean no_decode = FALSE;
   gboolean no_memory = FALSE;
@@ -95,6 +96,7 @@ main (gint   argc,
     { "pid", 'p', 0, G_OPTION_ARG_INT, &pid, N_("Make sysprof specific to a task"), N_("PID") },
     { "command", 'c', 0, G_OPTION_ARG_STRING, &command, N_("Run a command and profile the process"), 
N_("COMMAND") },
     { "force", 'f', 0, G_OPTION_ARG_NONE, &force, N_("Force overwrite the capture file") },
+    { "no-battery", 0, 0, G_OPTION_ARG_NONE, &no_cpu, N_("Disable recording of battery statistics") },
     { "no-cpu", 0, 0, G_OPTION_ARG_NONE, &no_cpu, N_("Disable recording of CPU statistics") },
     { "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") },
@@ -269,6 +271,13 @@ main (gint   argc,
       g_object_unref (source);
     }
 
+  if (!no_battery)
+    {
+      source = sysprof_battery_source_new ();
+      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]