sysprof: add toggle for graphics device info

From glxinfo and eglinfo.
This commit is contained in:
Christian Hergert
2023-08-06 15:42:30 -07:00
parent 15d9cbc28f
commit a7ef13c087
2 changed files with 48 additions and 0 deletions

View File

@ -435,6 +435,24 @@
</child>
</object>
</child-->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Devices</property>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">record_graphics_info</property>
<property name="title" translatable="yes">Include Device Information</property>
<property name="subtitle" translatable="yes">Records information about graphics hardware and drivers</property>
<child type="suffix">
<object class="GtkSwitch" id="record_graphics_info">
<property name="active" bind-source="recording_template" bind-flags="bidirectional|sync-create" bind-property="graphics-info"/>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>

View File

@ -38,6 +38,7 @@ struct _SysprofRecordingTemplate
guint disk_usage : 1;
guint energy_usage : 1;
guint frame_timings : 1;
guint graphics_info : 1;
guint javascript_stacks : 1;
guint memory_allocations : 1;
guint memory_usage : 1;
@ -60,6 +61,7 @@ enum {
PROP_ENERGY_USAGE,
PROP_ENVIRON,
PROP_FRAME_TIMINGS,
PROP_GRAPHICS_INFO,
PROP_JAVASCRIPT_STACKS,
PROP_MEMORY_ALLOCATIONS,
PROP_MEMORY_USAGE,
@ -139,6 +141,10 @@ sysprof_recording_template_get_property (GObject *object,
g_value_set_boolean (value, self->frame_timings);
break;
case PROP_GRAPHICS_INFO:
g_value_set_boolean (value, self->graphics_info);
break;
case PROP_JAVASCRIPT_STACKS:
g_value_set_boolean (value, self->javascript_stacks);
break;
@ -231,6 +237,10 @@ sysprof_recording_template_set_property (GObject *object,
self->frame_timings = g_value_get_boolean (value);
break;
case PROP_GRAPHICS_INFO:
self->graphics_info = g_value_get_boolean (value);
break;
case PROP_JAVASCRIPT_STACKS:
self->javascript_stacks = g_value_get_boolean (value);
break;
@ -331,6 +341,11 @@ sysprof_recording_template_class_init (SysprofRecordingTemplateClass *klass)
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_GRAPHICS_INFO] =
g_param_spec_boolean ("graphics-info", NULL, NULL,
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_JAVASCRIPT_STACKS] =
g_param_spec_boolean ("javascript-stacks", NULL, NULL,
FALSE,
@ -386,6 +401,7 @@ sysprof_recording_template_init (SysprofRecordingTemplate *self)
self->cpu_usage = TRUE;
self->disk_usage = TRUE;
self->frame_timings = TRUE;
self->graphics_info = TRUE;
self->memory_usage = TRUE;
self->native_stacks = TRUE;
self->network_usage = TRUE;
@ -524,6 +540,20 @@ sysprof_recording_template_apply (SysprofRecordingTemplate *self,
"org.gnome.Shell",
"/org/gnome/Sysprof3/Profiler"));
if (self->graphics_info)
{
sysprof_profiler_add_instrument (profiler,
g_object_new (SYSPROF_TYPE_SUBPROCESS_OUTPUT,
"stdout-path", "eglinfo",
"command-argv", (const char * const[]) {"eglinfo", NULL},
NULL));
sysprof_profiler_add_instrument (profiler,
g_object_new (SYSPROF_TYPE_SUBPROCESS_OUTPUT,
"stdout-path", "glxinfo",
"command-argv", (const char * const[]) {"glxinfo", NULL},
NULL));
}
if (self->memory_usage)
sysprof_profiler_add_instrument (profiler, sysprof_memory_usage_new ());