tools: add --no-throttle sysprof-cli option

This allows disabling the CPU governer by switching to "performance".
This commit is contained in:
Christian Hergert
2020-03-18 11:16:00 -07:00
parent 01d196abe4
commit 03906a84c6

View File

@ -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,