Skip to content

Commit

Permalink
Add an optional prefix_with_time_cmd flag to compiled_action. (#902)
Browse files Browse the repository at this point in the history
Work on debugging flutter/flutter#154437.

Must land and roll into flutter/engine before
flutter/engine#55633.
  • Loading branch information
matanlurey authored Oct 3, 2024
1 parent 3427a0c commit 8e48d18
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion build/compiled_action.gni
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
# of these change. If inputs is empty, the step will run only when the
# binary itself changes.
#
# prefix_with_time_cmd (optional)
# [bool] If true, the command will be prefixed with "time" to measure the
# time, CPU and memory usage of the tool, i.e. "time <command>" with
# appropriate arguments for the current platform.
#
# visibility
# deps
# args (all optional)
Expand Down Expand Up @@ -127,9 +132,27 @@ template("compiled_action") {
depfile = invoker.depfile
}

args = []
if (defined(invoker.prefix_with_time_cmd) && invoker.prefix_with_time_cmd) {
if (host_os == "linux") {
args += [
"time",
"-v",
]
} else if (host_os == "mac") {
args += [
"time",
"-l",
]
} else {
print("Warning: prefix_with_time_cmd is not supported on Windows.")
}
}

# The script takes as arguments the binary to run, and then the arguments
# to pass it.
args = [ rebase_path(host_executable, root_build_dir) ] + invoker.args
args += [ rebase_path(host_executable, root_build_dir) ]
args += invoker.args
}
}

Expand Down

0 comments on commit 8e48d18

Please sign in to comment.