diff options
| author | ruki <[email protected]> | 2022-02-08 22:51:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-02-08 22:51:07 +0800 |
| commit | d5ea563bc4e09826c06e444627690c04f23c4818 (patch) | |
| tree | 78a2da07782eb2ff958af6a9a663ee1baef8d513 | |
| parent | 6b74a4dcd274cf96f3b224975ca8a4580ebc0f65 (diff) | |
fix profiler
| -rw-r--r-- | xmake/core/base/profiler.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/xmake/core/base/profiler.lua b/xmake/core/base/profiler.lua index 41911c5db..12d316e16 100644 --- a/xmake/core/base/profiler.lua +++ b/xmake/core/base/profiler.lua @@ -148,19 +148,20 @@ function profiler:stop() end end --- get profiler mode +-- get profiler mode, e.g. perf, trace function profiler:mode() local mode = self._MODE - if not mode then - mode = os.getenv("XMAKE_PROFILE") + if mode == nil then + mode = os.getenv("XMAKE_PROFILE") or false self._MODE = mode end - return mode + return mode or nil end -- profiler is enabled? function profiler:enabled() - return self:mode() ~= nil + local mode = self:mode() + return mode ~= nil and (mode == "trace" or mode == "perf") end -- return module |
