From 03906a84c68861344bf3aa3d1abd339ec1fc10cc Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 18 Mar 2020 11:16:00 -0700 Subject: [PATCH] tools: add --no-throttle sysprof-cli option This allows disabling the CPU governer by switching to "performance". --- src/tools/sysprof-cli.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c index 0798b23a..32f3c428 100644 --- a/src/tools/sysprof-cli.c +++ b/src/tools/sysprof-cli.c @@ -203,6 +203,7 @@ main (gint argc, gboolean no_memory = FALSE; gboolean no_network = FALSE; gboolean no_perf = FALSE; + gboolean no_throttle = FALSE; gboolean version = FALSE; gboolean force = FALSE; gboolean use_trace_fd = FALSE; @@ -215,6 +216,7 @@ main (gint argc, int fd; int flags; GOptionEntry entries[] = { + { "no-throttle", 0, 0, G_OPTION_ARG_NONE, &no_throttle, N_("Disable CPU throttling while profiling") }, { "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") }, { "env", 'e', 0, G_OPTION_ARG_STRING_ARRAY, &envs, N_("Set environment variable for spawned process. Can be used multiple times."), N_("VAR=VALUE") }, @@ -504,6 +506,14 @@ Examples:\n\ g_object_unref (source); } + if (no_throttle) + { + source = sysprof_governor_source_new (); + sysprof_governor_source_set_disable_governor (SYSPROF_GOVERNOR_SOURCE (source), TRUE); + sysprof_profiler_add_source (profiler, source); + g_object_unref (source); + } + if (gnome_shell) { source = sysprof_proxy_source_new (G_BUS_TYPE_SESSION,