diff options
author | Gopi Krishna Menon <gopi.menon@collabora.com> | 2021-07-29 15:21:13 +0530 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-08-17 22:26:52 +0200 |
commit | 5c84de37ada9f5835bf0a644b0d5b7f7c7dedd2c (patch) | |
tree | 9d22124bc8c4d97d24a67835a84d4eb66d7c0574 /include | |
parent | 2dffae230ce7d8e1556b7c746c3ae8b4b9360fad (diff) |
Fix nesting level bug in ProfileZone
Move the profile zone global nesting variable into the source from
header and make it thread-local.
Change-Id: I97751f5c532d8e0e36adb7d9d383bd88f752953f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119657
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/profilezone.hxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index 43c792e0fcf7..ec2a5a41d34a 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -23,13 +23,14 @@ namespace comphelper class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { - static int s_nNesting; // level of nested zones. - long long m_nCreateTime; int m_nNesting; void addRecording(); + static void setNestingLevel(int nNestingLevel); + static int getNestingLevel(); + ProfileZone(const char* sName, const OUString &sArgs) : NamedEvent(sName, sArgs) , m_nNesting(-1) @@ -38,7 +39,8 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent { m_nCreateTime = getNow(); - m_nNesting = s_nNesting++; + m_nNesting = getNestingLevel(); + setNestingLevel(getNestingLevel() + 1); } else m_nCreateTime = 0; @@ -63,9 +65,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); } |