diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-04-27 16:42:15 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-04-29 14:15:46 +0200 |
commit | 04f41048afd7af36428ef6dd849ea3d7c61e2ec9 (patch) | |
tree | da597a9df9dc05a1adca813e54e35e0e7c4be34a /include | |
parent | 576082417393d8be35aea998a13fd3f79551db1c (diff) |
Introduce a new class NamedEvent to be used by the upcoming AsyncEvent, too
Don't use the term "profile id" as what we mean is the event *name*
(as used in the Chrome Trace Event format).
Change-Id: Id58a10f4c5f8a095ae75b9bf74131b70659ee701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114783
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/profilezone.hxx | 7 | ||||
-rw-r--r-- | include/comphelper/traceevent.hxx | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index de38a0dad985..2e0777295aa6 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -19,11 +19,10 @@ namespace comphelper { -class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent +class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { static int s_nNesting; // level of nested zones. - const char *m_sProfileId; long long m_nCreateTime; int m_nPid; int m_nNesting; @@ -35,8 +34,8 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent // Note that the char pointer is stored as such in the ProfileZone object and used in the // destructor, so be sure to pass a pointer that stays valid for the duration of the object's // lifetime. - ProfileZone(const char *sProfileId) - : m_sProfileId(sProfileId ? sProfileId : "(null)") + ProfileZone(const char* sName) + : NamedEvent(sName) { if (s_bRecording) { diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx index ff66a834e639..7e988bd063f0 100644 --- a/include/comphelper/traceevent.hxx +++ b/include/comphelper/traceevent.hxx @@ -13,6 +13,8 @@ #include <sal/config.h> #include <atomic> +#include <memory> +#include <set> #include <osl/process.h> #include <osl/time.h> @@ -32,7 +34,7 @@ protected: static void addRecording(const OUString& sObject); public: - static void addInstantEvent(const char* sProfileId); + static void addInstantEvent(const char* sName); static void startRecording(); static void stopRecording(); @@ -40,6 +42,17 @@ public: static css::uno::Sequence<OUString> getRecordingAndClear(); }; +class COMPHELPER_DLLPUBLIC NamedEvent : public TraceEvent +{ +protected: + const char* m_sName; + + NamedEvent(const char* sName) + : m_sName(sName ? sName : "(null)") + { + } +}; + } // namespace comphelper #endif // INCLUDED_COMPHELPER_TRACEEVENT_HXX |