summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-24 23:09:57 +0800
committerruki <[email protected]>2023-02-24 23:09:57 +0800
commit20ae460c6c9c2ebc3631dffb6429127ae4bee0ad (patch)
treea3df1558f1e2d9b91c958e77634c6209abf1b204
parent5c1e7a07bc73a9897137dafe089fb74cef5d8383 (diff)
show build time #3413
-rw-r--r--xmake/actions/build/main.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 31a63b1d1..12629409b 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -167,11 +167,13 @@ function main()
-- register exit callbacks
os.atexit(_on_exit)
+ local build_time
try
{
function ()
-- do check
+ local time = os.mclock()
check_targets(targetname, {build = true})
-- do rules before building
@@ -180,6 +182,9 @@ function main()
-- do build
_do_build(targetname, group_pattern)
+ -- get build time
+ build_time = os.mclock() - time
+
-- dump cache stats
if option.get("diagnosis") then
build_cache.dump_stats()
@@ -220,5 +225,9 @@ function main()
os.cd(oldir)
-- trace
- progress.show(100, "${color.success}build ok!")
+ local str = ""
+ if build_time then
+ str = string.format(", spent %ss", build_time / 1000)
+ end
+ progress.show(100, "${color.success}build ok%s", str)
end