summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-17 21:00:16 +0800
committerruki <[email protected]>2023-03-17 21:00:16 +0800
commit3fe3d5a451cddd998765598638d87c1cb6a34b01 (patch)
treee49f263068bdc29445432ff69a4ea1285c28fc13
parent193cef6e6c343fa613aa6bd245552c6b508e80d0 (diff)
improve check tag
-rw-r--r--xmake/core/base/profiler.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/core/base/profiler.lua b/xmake/core/base/profiler.lua
index 8d314f214..bb34c06c4 100644
--- a/xmake/core/base/profiler.lua
+++ b/xmake/core/base/profiler.lua
@@ -202,7 +202,12 @@ end
-- enter the given tag for perl:tag
function profiler:enter(name, ...)
- if self:is_perf("tag") then
+ local is_perf_tag = self._IS_PERF_TAG
+ if is_perf_tag == nil then
+ is_perf_tag = self:is_perf("tag")
+ self._IS_PERF_TAG = is_perf_tag
+ end
+ if is_perf_tag then
local argv = table.pack(...)
local report = self:_tag_report(name, argv)
report.calltime = os.clock()
@@ -212,7 +217,12 @@ end
-- leave the given tag for perl:tag
function profiler:leave(name, ...)
- if self:is_perf("tag") then
+ local is_perf_tag = self._IS_PERF_TAG
+ if is_perf_tag == nil then
+ is_perf_tag = self:is_perf("tag")
+ self._IS_PERF_TAG = is_perf_tag
+ end
+ if is_perf_tag then
local stoptime = os.clock()
local argv = table.pack(...)
local report = self:_tag_report(name, argv)