sysprof: Add debuginfod toggle on greeter and make it persist

This commit is contained in:
2025-02-01 02:37:16 +05:30
parent c9ee09240d
commit 0c5f0c3c65
4 changed files with 44 additions and 1 deletions

View File

@ -32,6 +32,7 @@ static gboolean memprof;
static gboolean tracer;
static gboolean gnome_shell;
static gboolean bundle_symbols;
// static gboolean debuginfod;
static gboolean session_bus;
static gboolean system_bus;
static gboolean gjs;
@ -45,7 +46,8 @@ static const GOptionEntry entries[] = {
{ "power-profile", 'p', 0, G_OPTION_ARG_STRING, &power_profile, "Use POWER_PROFILE for duration of recording", "power-saver|balanced|performance" },
{ "session-bus", 0, 0, G_OPTION_ARG_NONE, &session_bus, "Record D-Bus messages on the session bus" },
{ "system-bus", 0, 0, G_OPTION_ARG_NONE, &system_bus, "Record D-Bus messages on the system bus" },
{ "bundle-symbols", 'b', 0, G_OPTION_ARG_STRING, &bundle_symbols, "Bundle synbols with the capture" },
{ "bundle-symbols", 'b', 0, G_OPTION_ARG_STRING, &bundle_symbols, "Bundle symbols with the capture" },
// { "debuginfod", 'b', 0, G_OPTION_ARG_STRING, &debuginfod, "Enable debuginfod" },
{ 0 }
};
@ -192,6 +194,9 @@ main (int argc,
if (bundle_symbols)
sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ());
// if (debuginfod) /*TODO: this function has not been created anywhere yet*/
// sysprof_profiler_add_instrument (profiler, sysprof_debuginfod_new());
if (power_profile)
sysprof_profiler_add_instrument (profiler, sysprof_power_profile_new (power_profile));

View File

@ -57,6 +57,7 @@ struct _SysprofGreeter
GtkSwitch *record_session_bus;
GtkSwitch *record_system_bus;
GtkSwitch *bundle_symbols;
GtkSwitch *debuginfod;
GtkButton *record_to_memory;
AdwComboRow *power_combo;
AdwComboRow *sample_user_stack_size;
@ -540,6 +541,7 @@ sysprof_greeter_class_init (SysprofGreeterClass *klass)
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, app_environment);
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, bundle_symbols);
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, debuginfod);
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, envvars);
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, power_combo);
gtk_widget_class_bind_template_child (widget_class, SysprofGreeter, record_compositor);

View File

@ -619,6 +619,23 @@
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="activatable-widget">debuginfod</property>
<property name="title" translatable="yes">Debuginfod</property>
<property name="subtitle" translatable="yes">Enable Debuginfod</property>
<child type="suffix">
<object class="GtkSwitch" id="debuginfod">
<property name="active" bind-source="recording_template" bind-flags="bidirectional|sync-create" bind-property="debuginfod"/>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>

View File

@ -40,6 +40,7 @@ struct _SysprofRecordingTemplate
guint battery_charge : 1;
guint bundle_symbols : 1;
guint debuginfod : 1;
guint clear_environ : 1;
guint cpu_usage : 1;
guint disk_usage : 1;
@ -63,6 +64,7 @@ enum {
PROP_0,
PROP_BATTERY_CHARGE,
PROP_BUNDLE_SYMBOLS,
PROP_DEBUGINFOD,
PROP_CLEAR_ENVIRON,
PROP_COMMAND_LINE,
PROP_CPU_USAGE,
@ -122,6 +124,10 @@ sysprof_recording_template_get_property (GObject *object,
case PROP_BUNDLE_SYMBOLS:
g_value_set_boolean (value, self->bundle_symbols);
break;
case PROP_DEBUGINFOD:
g_value_set_boolean (value, self->debuginfod);
break;
case PROP_CLEAR_ENVIRON:
g_value_set_boolean (value, self->clear_environ);
@ -233,6 +239,10 @@ sysprof_recording_template_set_property (GObject *object,
case PROP_BUNDLE_SYMBOLS:
self->bundle_symbols = g_value_get_boolean (value);
break;
case PROP_DEBUGINFOD:
self->debuginfod = g_value_get_boolean (value);
break;
case PROP_CLEAR_ENVIRON:
self->clear_environ = g_value_get_boolean (value);
@ -346,6 +356,11 @@ sysprof_recording_template_class_init (SysprofRecordingTemplateClass *klass)
g_param_spec_boolean ("bundle-symbols", NULL, NULL,
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_DEBUGINFOD] =
g_param_spec_boolean ("debuginfod", NULL, NULL,
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_CLEAR_ENVIRON] =
g_param_spec_boolean ("clear-environ", NULL, NULL,
@ -464,6 +479,7 @@ static void
sysprof_recording_template_init (SysprofRecordingTemplate *self)
{
self->bundle_symbols = TRUE;
self->debuginfod = TRUE;
self->cpu_usage = TRUE;
self->disk_usage = TRUE;
self->graphics_info = TRUE;
@ -608,6 +624,9 @@ sysprof_recording_template_apply (SysprofRecordingTemplate *self,
if (self->bundle_symbols)
sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ());
if (self->debuginfod) /*TODO: This just uses an a preexisting function. Write the real function*/
sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ());
if (self->cpu_usage)
sysprof_profiler_add_instrument (profiler, sysprof_cpu_usage_new ());