[mutter/gbsneto/profiling-for-real: 2302/2303] meta/plugin: Add profiling vfuncs
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/profiling-for-real: 2302/2303] meta/plugin: Add profiling vfuncs
- Date: Sat, 20 Aug 2022 04:25:39 +0000 (UTC)
commit 2866af72c4c7eda8565990fff40bc83dd014a273
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Sep 2 16:02:51 2020 -0300
meta/plugin: Add profiling vfuncs
They depends on COGL_HAS_TRACING, which is already publicly exported
in cogl/cogl-defines.h.
src/compositor/meta-plugin-manager.c | 23 +++++++++++++++++++++++
src/compositor/meta-plugin-manager.h | 7 +++++++
src/meta/meta-plugin.h | 22 ++++++++++++++++++++++
3 files changed, 52 insertions(+)
---
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index bec5cd4559..9072e8dd03 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -420,3 +420,26 @@ meta_plugin_manager_locate_pointer (MetaPluginManager *plugin_mgr)
if (klass->locate_pointer)
klass->locate_pointer (plugin);
}
+
+#ifdef COGL_HAS_TRACING
+void
+meta_plugin_manager_start_profiler (MetaPluginManager *plugin_mgr,
+ SysprofCaptureWriter *writer)
+{
+ MetaPlugin *plugin = plugin_mgr->plugin;
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+
+ if (klass->start_profiler)
+ klass->start_profiler (plugin, writer);
+}
+
+void
+meta_plugin_manager_stop_profiler (MetaPluginManager *plugin_mgr)
+{
+ MetaPlugin *plugin = plugin_mgr->plugin;
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+
+ if (klass->stop_profiler)
+ klass->stop_profiler (plugin);
+}
+#endif
diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h
index a5fe0315ab..9d102cbb5c 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -104,4 +104,11 @@ MetaInhibitShortcutsDialog *
void meta_plugin_manager_locate_pointer (MetaPluginManager *mgr);
+#ifdef COGL_HAS_TRACING
+void meta_plugin_manager_start_profiler (MetaPluginManager *plugin_mgr,
+ SysprofCaptureWriter *writer);
+
+void meta_plugin_manager_stop_profiler (MetaPluginManager *plugin_mgr);
+#endif
+
#endif
diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h
index 663a75fa9d..323a618ba9 100644
--- a/src/meta/meta-plugin.h
+++ b/src/meta/meta-plugin.h
@@ -26,12 +26,17 @@
#include <gmodule.h>
#include "clutter/clutter.h"
+#include "cogl/cogl-defines.h"
#include "meta/compositor-mutter.h"
#include "meta/compositor.h"
#include "meta/meta-close-dialog.h"
#include "meta/meta-inhibit-shortcuts-dialog.h"
#include "meta/types.h"
+#ifdef COGL_HAS_TRACING
+#include <sysprof-capture.h>
+#endif
+
#define META_TYPE_PLUGIN (meta_plugin_get_type ())
META_EXPORT
@@ -247,6 +252,23 @@ struct _MetaPluginClass
* on screen to draw user attention on the pointer location.
*/
void (*locate_pointer) (MetaPlugin *plugin);
+
+#ifdef COGL_HAS_TRACING
+ /**
+ * MetaPluginClass::start_profiler:
+ *
+ * Virtual function called when profiling starts.
+ */
+ void (*start_profiler) (MetaPlugin *plugin,
+ SysprofCaptureWriter *writer);
+
+ /**
+ * MetaPluginClass::stop_profiler:
+ *
+ * Virtual function called when profiling stops.
+ */
+ void (*stop_profiler) (MetaPlugin *plugin);
+#endif
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]