context: Start persistent profiling via command line argument

Persistent profiling was started via an env var, but that's rather hard
to discover and remember without grepping; change to use a command line
argument.

The profiler is started early, even during (though late in)
configuration, but configuration should ideally be instant and pointless
to configure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
This commit is contained in:
Jonas Ådahl
2023-05-10 22:26:08 +02:00
committed by Marge Bot
parent e16d683721
commit 1ca76e9b9c
5 changed files with 42 additions and 16 deletions

View File

@ -73,6 +73,7 @@ typedef struct _MetaContextMainOptions
#ifdef HAVE_NATIVE_BACKEND
GList *virtual_monitor_infos;
#endif
char *trace_file;
} MetaContextMainOptions;
struct _MetaContextMain
@ -298,6 +299,10 @@ meta_context_main_configure (MetaContext *context,
context_main->options.sm.client_id = g_strdup (desktop_autostart_id);
}
#ifdef HAVE_PROFILER
meta_context_set_trace_file (context, context_main->options.trace_file);
#endif
g_unsetenv ("DESKTOP_AUTOSTART_ID");
return TRUE;
@ -662,6 +667,12 @@ meta_context_main_add_option_entries (MetaContextMain *context_main)
N_("Run with X11 backend")
},
#endif
{
"profile", 0, 0, G_OPTION_ARG_FILENAME,
&context_main->options.trace_file,
N_("Profile performance using trace instrumentation"),
"FILE"
},
{ NULL }
};