governor: add UI to toggle CPU governor setting

This commit is contained in:
Christian Hergert
2019-06-14 08:04:24 -07:00
parent 1254b16140
commit a7832ce0d4
2 changed files with 61 additions and 2 deletions

View File

@ -39,6 +39,7 @@ struct _SysprofProfilerAssistant
GtkBin parent_instance;
/* Template Objects */
GtkSwitch *allow_throttling;
GtkButton *record_button;
GtkEntry *command_line;
GtkRevealer *process_revealer;
@ -246,6 +247,12 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
sysprof_profiler_add_source (profiler, proc_source);
#endif
if (!gtk_switch_get_active (self->allow_throttling))
{
g_autoptr(SysprofSource) governor = sysprof_governor_source_new ();
sysprof_profiler_add_source (profiler, governor);
}
/* Always add symbol decoder to save to file immediately */
symbols_source = sysprof_symbols_source_new ();
sysprof_profiler_add_source (profiler, symbols_source);
@ -279,6 +286,7 @@ sysprof_profiler_assistant_class_init (SysprofProfilerAssistantClass *klass)
G_TYPE_NONE, 1, SYSPROF_TYPE_PROFILER);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-profiler-assistant.ui");
gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, allow_throttling);
gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, aid_flow_box);
gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, command_line);
gtk_widget_class_bind_template_child (widget_class, SysprofProfilerAssistant, environ_editor);

View File

@ -159,7 +159,7 @@
</object>
<packing>
<property name="column">center</property>
<property name="row">3</property>
<property name="row">4</property>
</packing>
</child>
<child>
@ -415,6 +415,55 @@
<property name="row">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="label" translatable="yes">Allow CPU Throttling</property>
<property name="xalign">1.0</property>
<property name="valign">start</property>
<property name="visible">true</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="column">left</property>
<property name="row">3</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="visible">true</property>
<child>
<object class="GtkSwitch" id="allow_throttling">
<property name="active">true</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="visible">true</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">If disabled, your CPU will be placed in performance mode. It will be restored after profiling.</property>
<property name="max-width-chars">10</property>
<property name="wrap">true</property>
<property name="visible">true</property>
<property name="xalign">0.0</property>
<attributes>
<attribute name="scale" value="0.8333"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
<packing>
<property name="column">center</property>
<property name="row">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="record_button">
<property name="label" translatable="yes">_Record</property>
@ -430,7 +479,7 @@
</object>
<packing>
<property name="column">center</property>
<property name="row">4</property>
<property name="row">5</property>
</packing>
</child>
</object>
@ -455,6 +504,8 @@
<property name="mode">vertical</property>
<widgets>
<widget name="label2"/>
<widget name="label3"/>
<widget name="allow_throttling"/>
<widget name="launch_switch"/>
</widgets>
</object>