Skip to content

Commit 8e48d18

Browse files
authored
Add an optional prefix_with_time_cmd flag to compiled_action. (#902)
Work on debugging flutter/flutter#154437. Must land and roll into flutter/engine before flutter/engine#55633.
1 parent 3427a0c commit 8e48d18

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

build/compiled_action.gni

+24-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
# of these change. If inputs is empty, the step will run only when the
2929
# binary itself changes.
3030
#
31+
# prefix_with_time_cmd (optional)
32+
# [bool] If true, the command will be prefixed with "time" to measure the
33+
# time, CPU and memory usage of the tool, i.e. "time <command>" with
34+
# appropriate arguments for the current platform.
35+
#
3136
# visibility
3237
# deps
3338
# args (all optional)
@@ -127,9 +132,27 @@ template("compiled_action") {
127132
depfile = invoker.depfile
128133
}
129134

135+
args = []
136+
if (defined(invoker.prefix_with_time_cmd) && invoker.prefix_with_time_cmd) {
137+
if (host_os == "linux") {
138+
args += [
139+
"time",
140+
"-v",
141+
]
142+
} else if (host_os == "mac") {
143+
args += [
144+
"time",
145+
"-l",
146+
]
147+
} else {
148+
print("Warning: prefix_with_time_cmd is not supported on Windows.")
149+
}
150+
}
151+
130152
# The script takes as arguments the binary to run, and then the arguments
131153
# to pass it.
132-
args = [ rebase_path(host_executable, root_build_dir) ] + invoker.args
154+
args += [ rebase_path(host_executable, root_build_dir) ]
155+
args += invoker.args
133156
}
134157
}
135158

0 commit comments

Comments
 (0)