diff options
author | Gopi Krishna Menon <gopi.menon@collabora.com> | 2021-07-29 15:21:13 +0530 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-10-26 10:24:14 +0200 |
commit | 2623b86bcdf90f8fbf1fbf32c4a8e78380625a19 (patch) | |
tree | 2a860f348b0dacf782ebacffc99a4104ffb4e94c /include | |
parent | c4a6d96cfa427a1b8b443ea2664ec5b6ab964f18 (diff) |
Fix Nesting Level Bug in ProfileZone
Moves the profile zone global nesting variable into the source from header and makes it threadlocal
Change-Id: I97751f5c532d8e0e36adb7d9d383bd88f752953f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119662
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit 74f4a1796f94477d459c71d0a0aaa8f4a430e208)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119618
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/profilezone.hxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index 2a8bb9f3dba0..aa5d41070a81 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -22,8 +22,6 @@ namespace comphelper { class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { - static int s_nNesting; // level of nested zones. - long long m_nCreateTime; bool m_bConsole; void stopConsole(); @@ -31,7 +29,10 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent void addRecording(); - ProfileZone(const char* sName, const OUString &sArgs, bool bConsole) + static void setNestingLevel(int nNestingLevel); + static int getNestingLevel(); + + ProfileZone(const char* sName, const OUString &sArgs, bool bConsole) : NamedEvent(sName, sArgs) , m_bConsole(bConsole) , m_nNesting(-1) @@ -40,7 +41,8 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { m_nCreateTime = getNow(); - m_nNesting = s_nNesting++; + m_nNesting = getNestingLevel(); + setNestingLevel(getNestingLevel() + 1); } else m_nCreateTime = 0; @@ -77,9 +79,9 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { if (m_nCreateTime > 0) { - s_nNesting--; + setNestingLevel(getNestingLevel() - 1); - if (m_nNesting != s_nNesting) + if (m_nNesting != getNestingLevel()) { SAL_WARN("comphelper.traceevent", "Incorrect ProfileZone nesting for " << m_sName); } |