sysprof: add toggle for hardware information via lspci/lsusb

This commit is contained in:
Christian Hergert
2023-08-06 15:58:32 -07:00
parent 9ab48d6eeb
commit 2fa355a323
2 changed files with 49 additions and 2 deletions

View File

@ -441,7 +441,7 @@
<child>
<object class="AdwActionRow">
<property name="activatable-widget">record_graphics_info</property>
<property name="title" translatable="yes">Include Device Information</property>
<property name="title" translatable="yes">Include GPU 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">
@ -476,7 +476,7 @@
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Logging</property>
<property name="title" translatable="yes">Details</property>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">record_system_logs</property>
@ -492,6 +492,23 @@
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="activatable-widget">record_hardware_info</property>
<property name="title" translatable="yes">Include Hardware Information</property>
<property name="subtitle" translatable="yes">Records information about PCI and USB devices</property>
<child type="suffix">
<object class="GtkSwitch" id="record_hardware_info">
<property name="active" bind-source="recording_template" bind-flags="bidirectional|sync-create" bind-property="hardware-info"/>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Symbols</property>

View File

@ -39,6 +39,7 @@ struct _SysprofRecordingTemplate
guint energy_usage : 1;
guint frame_timings : 1;
guint graphics_info : 1;
guint hardware_info : 1;
guint javascript_stacks : 1;
guint memory_allocations : 1;
guint memory_usage : 1;
@ -62,6 +63,7 @@ enum {
PROP_ENVIRON,
PROP_FRAME_TIMINGS,
PROP_GRAPHICS_INFO,
PROP_HARDWARE_INFO,
PROP_JAVASCRIPT_STACKS,
PROP_MEMORY_ALLOCATIONS,
PROP_MEMORY_USAGE,
@ -145,6 +147,10 @@ sysprof_recording_template_get_property (GObject *object,
g_value_set_boolean (value, self->graphics_info);
break;
case PROP_HARDWARE_INFO:
g_value_set_boolean (value, self->hardware_info);
break;
case PROP_JAVASCRIPT_STACKS:
g_value_set_boolean (value, self->javascript_stacks);
break;
@ -241,6 +247,10 @@ sysprof_recording_template_set_property (GObject *object,
self->graphics_info = g_value_get_boolean (value);
break;
case PROP_HARDWARE_INFO:
self->hardware_info = g_value_get_boolean (value);
break;
case PROP_JAVASCRIPT_STACKS:
self->javascript_stacks = g_value_get_boolean (value);
break;
@ -346,6 +356,11 @@ sysprof_recording_template_class_init (SysprofRecordingTemplateClass *klass)
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_HARDWARE_INFO] =
g_param_spec_boolean ("hardware-info", NULL, NULL,
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_JAVASCRIPT_STACKS] =
g_param_spec_boolean ("javascript-stacks", NULL, NULL,
FALSE,
@ -402,6 +417,7 @@ sysprof_recording_template_init (SysprofRecordingTemplate *self)
self->disk_usage = TRUE;
self->frame_timings = TRUE;
self->graphics_info = TRUE;
self->hardware_info = TRUE;
self->memory_usage = TRUE;
self->native_stacks = TRUE;
self->network_usage = TRUE;
@ -554,6 +570,20 @@ sysprof_recording_template_apply (SysprofRecordingTemplate *self,
NULL));
}
if (self->hardware_info)
{
sysprof_profiler_add_instrument (profiler,
g_object_new (SYSPROF_TYPE_SUBPROCESS_OUTPUT,
"stdout-path", "lsusb",
"command-argv", (const char * const[]) {"lsusb", "-v", NULL},
NULL));
sysprof_profiler_add_instrument (profiler,
g_object_new (SYSPROF_TYPE_SUBPROCESS_OUTPUT,
"stdout-path", "lspci",
"command-argv", (const char * const[]) {"lspci", "-v", NULL},
NULL));
}
if (self->memory_usage)
sysprof_profiler_add_instrument (profiler, sysprof_memory_usage_new ());