Skip to content

Commit d02b940

Browse files
committed
diag: add timing markers around tool staging bulk copy
Temporary instrumentation to measure the actual cost of the bulk runfiles copy on each CI platform. Emits TOOL_STAGING_START/END with nanosecond timestamps to the build log, then greps them to stderr in cleanup_on_success so they appear in Bazel action output. Remove after measurement.
1 parent 2df8feb commit d02b940

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

foreign_cc/private/framework.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ def wrap_outputs(ctx, lib_name, configure_name, script_text, env_prelude, build_
709709
ctx,
710710
"cleanup_on_success",
711711
"\n".join([
712+
# Temporary: extract staging timing from the build log
713+
"grep TOOL_STAGING $$BUILD_LOG$$ >&2 || true",
712714
"##rm_rf## $$BUILD_TMPDIR$$",
713715
"##rm_rf## $$EXT_BUILD_DEPS$$",
714716
# On Windows with short paths, BUILD_TMPDIR and EXT_BUILD_DEPS are
@@ -871,6 +873,8 @@ def _copy_deps_and_tools(files):
871873
else:
872874
lines.append("##copy_file_to_dir## \"$$EXT_BUILD_ROOT$$/{}\" \"$$EXT_BUILD_DEPS$$/bin\"".format(tool_path))
873875

876+
if files.tools_runfiles:
877+
lines.append("##echo## \"TOOL_STAGING_START t=$(date +%s%N)\"")
874878
for tool in files.tools_runfiles:
875879
staged_runfiles = "{}.runfiles".format(tool.staged_path)
876880
source_runfiles = "$$EXT_BUILD_ROOT$$/{}.runfiles".format(tool.invoke_path)
@@ -895,6 +899,8 @@ def _copy_deps_and_tools(files):
895899
lines.append("export RUNFILES_DIR=\"{staged_runfiles}\"".format(
896900
staged_runfiles = staged_runfiles,
897901
))
902+
if files.tools_runfiles:
903+
lines.append("##echo## \"TOOL_STAGING_END t=$(date +%s%N)\"")
898904

899905
for ext_dir in files.ext_build_dirs:
900906
lines.append("##symlink_to_dir## $$EXT_BUILD_ROOT$$/{} $$EXT_BUILD_DEPS$$ True".format(_file_path(ext_dir)))

0 commit comments

Comments
 (0)