[d8] Flush output after each write

{console.log} messages from tests can currently be buffered, which makes
it impossible to use them for seeing how long certain code executes.

R=ahaas@chromium.org

Change-Id: I785f7809c0bd837074a1c8a03465111a744e4d87
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4061729
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84539}
This commit is contained in:
Clemens Backes 2022-11-28 18:14:42 +01:00 committed by V8 LUCI CQ
parent 473cab6ce6
commit 699c4d28bb

View File

@ -30,6 +30,9 @@ void WriteToFile(const char* prefix, FILE* file, Isolate* isolate,
}
}
fprintf(file, "\n");
// Flush the file to avoid output to pile up in a buffer. Console output is
// often used for timing, so it should appear as soon as the code is executed.
fflush(file);
}
} // anonymous namespace