diff mbox series

[RFC,1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp

Message ID 20220119120229.68627-2-y.karadz@gmail.com (mailing list archive)
State Deferred
Headers show
Series Allow GUI plugins to build standalone | expand

Commit Message

Yordan Karadzhov Jan. 19, 2022, 12:02 p.m. UTC
Here we will place all GUI-related APIs that will be exposed to
the external plugins. For the moment we add only two such APIs
that will allow the plugins to manipulate the markers.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/CMakeLists.txt   |  1 +
 src/KsPluginsGUI.cpp | 27 +++++++++++++++++++++++++++
 src/KsPluginsGUI.hpp | 22 ++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 src/KsPluginsGUI.cpp
 create mode 100644 src/KsPluginsGUI.hpp
diff mbox series

Patch

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9e0b4ae..4c26122 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -97,6 +97,7 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
                                                             KsTraceGraph.cpp
                                                             KsTraceViewer.cpp
                                                             KsMainWindow.cpp
+                                                            KsPluginsGUI.cpp
                                                             KsCaptureDialog.cpp
                                                             KsQuickContextMenu.cpp
                                                             KsAdvFilteringDialog.cpp)
diff --git a/src/KsPluginsGUI.cpp b/src/KsPluginsGUI.cpp
new file mode 100644
index 0000000..a964510
--- /dev/null
+++ b/src/KsPluginsGUI.cpp
@@ -0,0 +1,27 @@ 
+// SPDX-License-Identifier: LGPL-2.1
+
+/*
+ * Copyright 2022 VMware Inc, Yordan Karadzhov (VMware) <y.karadz@gmail.com>
+ */
+
+/**
+  *  @file    KsPluginsGUI.cpp
+  *  @brief   KernelShark C++ plugin declarations.
+  */
+
+// KernelShark
+#include "KsPluginsGUI.hpp"
+#include "KsMainWindow.hpp"
+#include "KsDualMarker.hpp"
+
+void markEntryA(void *ks_ptr, const kshark_entry *e)
+{
+	KsMainWindow *ks = static_cast<KsMainWindow *>(ks_ptr);
+	ks->markEntry(e, DualMarkerState::A);
+}
+
+void markEntryB(void *ks_ptr, const kshark_entry *e)
+{
+	KsMainWindow *ks = static_cast<KsMainWindow *>(ks_ptr);
+	ks->markEntry(e, DualMarkerState::B);
+}
diff --git a/src/KsPluginsGUI.hpp b/src/KsPluginsGUI.hpp
new file mode 100644
index 0000000..808a951
--- /dev/null
+++ b/src/KsPluginsGUI.hpp
@@ -0,0 +1,22 @@ 
+/* SPDX-License-Identifier: LGPL-2.1 */
+
+/*
+ * Copyright 2022 VMware Inc, Yordan Karadzhov <y.karadz@gmail.com>
+ */
+
+/**
+  *  @file    KsPluginsGUI.hpp
+  *  @brief   KernelShark C++ plugin declarations.
+  */
+
+#ifndef _KS_PLUGINS_GUI_H
+#define _KS_PLUGINS_GUI_H
+
+// KernelShark
+#include "libkshark.h"
+
+void markEntryA(void *ks_ptr, const kshark_entry *e);
+
+void markEntryB(void *ks_ptr, const kshark_entry *e);
+
+#endif