Commit 4c0e3614 authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[builtins] Use absolute log file name in tools/builtins-pgo/generate.py

... and report an error if the profile file can't be opened for writing.
Also, overwrite the profile file instead of appending if the file
exists.

Bug: v8:10470
Change-Id: I0da0ee8d901a0c477b7f71ba23436243f93bd0ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3902521
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83294}
parent 2d3f21cf
......@@ -4621,7 +4621,11 @@ void Isolate::DumpAndResetStats() {
#endif // V8_RUNTIME_CALL_STATS
if (BasicBlockProfiler::Get()->HasData(this)) {
if (v8_flags.turbo_profiling_output) {
auto f = std::fopen(v8_flags.turbo_profiling_output, "a");
FILE* f = std::fopen(v8_flags.turbo_profiling_output, "w");
if (f == nullptr) {
FATAL("Unable to open file \"%s\" for writing.\n",
v8_flags.turbo_profiling_output.value());
}
OFStream pgo_stream(f);
BasicBlockProfiler::Get()->Log(this, pgo_stream);
} else {
......
......@@ -81,7 +81,7 @@ for arch, gn_args in [(args.v8_target_cpu, GN_ARGS_TEMPLATE)]:
d8_path = build_d8(build_dir, gn_args)
benchmark_dir = args.benchmark_path.parent
benchmark_file = args.benchmark_path.name
log_path = build_dir / "v8.builtins.pgo"
log_path = (build_dir / "v8.builtins.pgo").absolute()
run([d8_path, f"--turbo-profiling-output={log_path}", benchmark_file],
cwd=benchmark_dir)
get_hints_path = tools_pgo_dir / "get_hints.py"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment