diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-04-27 09:20:32 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-04-29 14:10:53 +0200 |
commit | ef865bba15aa351dd32b909eedac55d1e2a1771b (patch) | |
tree | bd3f8a3711e10b713b21c73acf3230aeeb567f23 /include | |
parent | 27cf65fb14e23f9afe1a45d7a3f1c8a997f07660 (diff) |
Extend the trace event API with instant events
As a preparetion for further work, refactor ProfileZone into a base
class TraceEvent and a derived class ProfileZone.
Change-Id: I3a93c79f46ffc5768ddaf338789fe2daa225ef4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114776
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 | 13 | ||||
-rw-r--r-- | include/comphelper/traceevent.hxx | 43 |
2 files changed, 45 insertions, 11 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index 3f758d88d987..bddf313f62d2 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -12,24 +12,15 @@ #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; int m_nPid; 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: */ |