Move MetaProfiler from the backend to core

It's not really a backend thing, and we'll want to profile e.g. loading
the backend too, so create it very early and destroy it very late and
let MetaContextMain own it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
This commit is contained in:
Jonas Ådahl 2022-10-12 22:30:07 +02:00 committed by Marge Bot
parent 50288d1ead
commit ca2057da9a
6 changed files with 20 additions and 20 deletions

View File

@ -10,7 +10,6 @@ data/org.gnome.mutter.wayland.gschema.xml.in
src/backends/meta-input-settings.c
src/backends/meta-monitor.c
src/backends/meta-monitor-manager.c
src/backends/meta-profiler.c
src/backends/x11/meta-clutter-backend-x11.c
src/compositor/compositor.c
src/compositor/meta-background.c
@ -19,6 +18,7 @@ src/core/display.c
src/core/keybindings.c
src/core/meta-context-main.c
src/core/meta-pad-action-mapper.c
src/core/meta-profiler.c
src/core/mutter.c
src/core/prefs.c
src/core/util.c

View File

@ -74,10 +74,6 @@
#include "meta/meta-enum-types.h"
#include "meta/util.h"
#ifdef HAVE_PROFILER
#include "backends/meta-profiler.h"
#endif
#ifdef HAVE_REMOTE_DESKTOP
#include "backends/meta-dbus-session-watcher.h"
#include "backends/meta-remote-access-controller-private.h"
@ -158,10 +154,6 @@ struct _MetaBackendPrivate
MetaRemoteDesktop *remote_desktop;
#endif
#ifdef HAVE_PROFILER
MetaProfiler *profiler;
#endif
#ifdef HAVE_LIBWACOM
WacomDeviceDatabase *wacom_db;
#endif
@ -262,10 +254,6 @@ meta_backend_dispose (GObject *object)
g_clear_object (&priv->settings);
#ifdef HAVE_PROFILER
g_clear_object (&priv->profiler);
#endif
g_clear_pointer (&priv->default_seat, clutter_seat_destroy);
g_clear_pointer (&priv->stage, clutter_actor_destroy);
g_clear_pointer (&priv->idle_manager, meta_idle_manager_free);
@ -1220,10 +1208,6 @@ meta_backend_initable_init (GInitable *initable,
system_bus_gotten_cb,
backend);
#ifdef HAVE_PROFILER
priv->profiler = meta_profiler_new ();
#endif
if (!init_clutter (backend, error))
return FALSE;

View File

@ -31,6 +31,10 @@
#include "core/prefs-private.h"
#include "core/util-private.h"
#ifdef HAVE_PROFILER
#include "core/meta-profiler.h"
#endif
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland.h"
#endif
@ -81,6 +85,10 @@ typedef struct _MetaContextPrivate
#ifdef RLIMIT_NOFILE
struct rlimit saved_rlimit_nofile;
#endif
#ifdef HAVE_PROFILER
MetaProfiler *profiler;
#endif
} MetaContextPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaContext, meta_context, G_TYPE_OBJECT)
@ -689,6 +697,10 @@ meta_context_finalize (GObject *object)
MetaContext *context = META_CONTEXT (object);
MetaContextPrivate *priv = meta_context_get_instance_private (context);
#ifdef HAVE_PROFILER
g_clear_object (&priv->profiler);
#endif
g_clear_pointer (&priv->gnome_wm_keybindings, g_free);
g_clear_pointer (&priv->plugin_name, g_free);
g_clear_pointer (&priv->name, g_free);
@ -734,6 +746,10 @@ meta_context_init (MetaContext *context)
MetaContextPrivate *priv = meta_context_get_instance_private (context);
g_autoptr (GError) error = NULL;
#ifdef HAVE_PROFILER
priv->profiler = meta_profiler_new ();
#endif
priv->plugin_gtype = G_TYPE_NONE;
priv->gnome_wm_keybindings = g_strdup ("Mutter");

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "src/backends/meta-profiler.h"
#include "src/core/meta-profiler.h"
#include <glib-unix.h>
#include <glib/gi18n.h>

View File

@ -877,8 +877,8 @@ mutter_built_sources += dbus_input_mapping_built_sources
if have_profiler
mutter_sources += [
'backends/meta-profiler.c',
'backends/meta-profiler.h',
'core/meta-profiler.c',
'core/meta-profiler.h',
]
if sysprof_dep.type_name() == 'pkgconfig'