summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-01-12 00:21:14 +0800
committerruki <[email protected]>2017-01-12 00:21:14 +0800
commitd67955c9dba18a933e701707b812a988da8ca74f (patch)
tree8f78d510923b9fc98d3cfa4353c55e2f7101b1be
parent1be86fced4accecba8f00b903610a42dbd32f33a (diff)
add profile argument
-rw-r--r--xmake/core/main.lua12
-rw-r--r--xmake/core/project/task.lua13
2 files changed, 15 insertions, 10 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index b6f2205ed..976747399 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -104,9 +104,6 @@ end
-- the main function
function main.done()
- -- start profiling
--- profiler:start()
-
-- init
main._init()
@@ -115,6 +112,11 @@ function main.done()
return -1
end
+ -- start profiling
+ if option.get("profile") then
+ profiler:start()
+ end
+
-- run help?
if main._help() then
return 0
@@ -134,7 +136,9 @@ function main.done()
deprecated.dump()
-- stop profiling
--- profiler:stop()
+ if option.get("profile") then
+ profiler:stop()
+ end
-- ok
return 0
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua
index d01b5e089..2dff95962 100644
--- a/xmake/core/project/task.lua
+++ b/xmake/core/project/task.lua
@@ -134,16 +134,17 @@ function task._translate_menu(menu)
-- add common options
table.insert(options, 1, {'v', "verbose", "k", nil, "Print lots of verbose information." })
table.insert(options, 2, {nil, "backtrace", "k", nil, "Print backtrace information for debugging." })
- table.insert(options, 3, {nil, "version", "k", nil, "Print the version number and exit." })
- table.insert(options, 4, {'h', "help", "k", nil, "Print this help message and exit." })
- table.insert(options, 5, {})
- table.insert(options, 6, {'F', "file", "kv", nil, "Read a given xmake.lua file." })
- table.insert(options, 7, {'P', "project", "kv", nil, "Change to the given project directory."
+ table.insert(options, 3, {nil, "profile", "k", nil, "Print performance data for debugging." })
+ table.insert(options, 4, {nil, "version", "k", nil, "Print the version number and exit." })
+ table.insert(options, 5, {'h', "help", "k", nil, "Print this help message and exit." })
+ table.insert(options, 6, {})
+ table.insert(options, 7, {'F', "file", "kv", nil, "Read a given xmake.lua file." })
+ table.insert(options, 8, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
, " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
, " 3. The Current Directory" })
- table.insert(options, 8, {})
+ table.insert(options, 9, {})
end