[mutter/gbsneto/profiling-for-real: 2/3] 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: 2/3] meta/plugin: Add profiling vfuncs
- Date: Thu, 19 Nov 2020 13:44:08 +0000 (UTC)
commit d6af581f9ad7fb37de167860691e0d760c3a7c43
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 47bf922db6..eee3ace943 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -417,3 +417,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 d1c007fa19..0fd0d7703a 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -102,4 +102,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 1bc19a5f0e..98396bac39 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]