summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-04-27 09:20:32 +0300
committerTor Lillqvist <tml@collabora.com>2021-04-28 11:41:19 +0200
commitf0b4eecdba71f8bce8466b580971cdeea7514c22 (patch)
treed0029d35ccd01811687bccaa2033aa04ccda1859 /include
parent9fa66a3de4d6d14f91af8064f0af510070f65567 (diff)
Extend the trace event API with instant events
Change-Id: I3a93c79f46ffc5768ddaf338789fe2daa225ef4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114696 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/profilezone.hxx13
-rw-r--r--include/comphelper/traceevent.hxx43
2 files changed, 45 insertions, 11 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index 3988199cdf6b..529e3d411742 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -12,23 +12,14 @@
#include <sal/config.h>
-#include <atomic>
-
-#include <osl/process.h>
-#include <osl/time.h>
-#include <com/sun/star/uno/Sequence.h>
-#include <comphelper/comphelperdllapi.h>
-#include <rtl/ustring.hxx>
+#include <comphelper/traceevent.hxx>
// implementation of XToolkitExperimental profiling API
namespace comphelper
{
-class COMPHELPER_DLLPUBLIC ProfileZone
+class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
{
-private:
- static std::atomic<bool> s_bRecording; // true during recording
- static int s_nNesting;
const char* m_sProfileId;
long long m_nCreateTime;
bool m_bConsole;
diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx
new file mode 100644
index 000000000000..5c922b281487
--- /dev/null
+++ b/include/comphelper/traceevent.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef INCLUDED_COMPHELPER_TRACEEVENT_HXX
+#define INCLUDED_COMPHELPER_TRACEEVENT_HXX
+
+#include <sal/config.h>
+
+#include <atomic>
+
+#include <osl/process.h>
+#include <osl/time.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <comphelper/comphelperdllapi.h>
+#include <rtl/ustring.hxx>
+
+// implementation of XToolkitExperimental profiling API
+
+namespace comphelper
+{
+class COMPHELPER_DLLPUBLIC TraceEvent
+{
+protected:
+ static std::atomic<bool> s_bRecording; // true during recording
+ static int s_nNesting;
+
+ static void addRecording(const OUString& sObject);
+
+public:
+ static void addInstantEvent(const char* sProfileId);
+};
+
+} // namespace comphelper
+
+#endif // INCLUDED_COMPHELPER_TRACEEVENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */