summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-01-12 00:27:19 +0800
committerruki <[email protected]>2017-01-12 00:27:19 +0800
commita44dac295dc3fe982616bd642f0d3e36d3d1f2ec (patch)
treeb8d280520dfb35b8cda927fbf960b16c9a17ecf4
parentd67955c9dba18a933e701707b812a988da8ca74f (diff)
optimize profiler trace
-rw-r--r--xmake/core/base/profiler.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/base/profiler.lua b/xmake/core/base/profiler.lua
index 3e8516263..480e3fc75 100644
--- a/xmake/core/base/profiler.lua
+++ b/xmake/core/base/profiler.lua
@@ -198,7 +198,15 @@ function profiler:stop(mode)
-- show reports
for _, report in ipairs(self._REPORTS) do
- utils.print("%04.3f, %5.2f%%, %7d, %s", report.totaltime, (report.totaltime / totaltime) * 100, report.callcount, report.title)
+
+ -- calculate percent
+ local percent = (report.totaltime / totaltime) * 100
+ if percent < 1 then
+ break
+ end
+
+ -- trace
+ utils.print("%6.3f, %6.2f%%, %7d, %s", report.totaltime, percent, report.callcount, report.title)
end
end
end