[turbolizer] Presenting filename in the tab label

Bug: v8:7327
Change-Id: I7312ec4fb23bbf1c67fdf110de221105279bfa4a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3837859
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Danylo Boiko <danielboyko02@gmail.com>
Cr-Commit-Position: refs/heads/main@{#82566}
This commit is contained in:
Danylo Boiko 2022-08-18 14:48:28 +03:00 committed by V8 LUCI CQ
parent 5015c4ea74
commit 85a5f5b665
3 changed files with 10 additions and 5 deletions

View File

@ -232,15 +232,17 @@ std::unique_ptr<char[]> GetVisualizerLogFileName(OptimizedCompilationInfo* info,
const char* suffix) { const char* suffix) {
base::EmbeddedVector<char, 256> filename(0); base::EmbeddedVector<char, 256> filename(0);
std::unique_ptr<char[]> debug_name = info->GetDebugName(); std::unique_ptr<char[]> debug_name = info->GetDebugName();
const char* file_prefix = FLAG_trace_turbo_file_prefix.value();
int optimization_id = info->IsOptimizing() ? info->optimization_id() : 0; int optimization_id = info->IsOptimizing() ? info->optimization_id() : 0;
if (strlen(debug_name.get()) > 0) { if (strlen(debug_name.get()) > 0) {
SNPrintF(filename, "turbo-%s-%i", debug_name.get(), optimization_id); SNPrintF(filename, "%s-%s-%i", file_prefix, debug_name.get(),
} else if (info->has_shared_info()) {
SNPrintF(filename, "turbo-%p-%i",
reinterpret_cast<void*>(info->shared_info()->address()),
optimization_id); optimization_id);
} else if (info->has_shared_info()) {
SNPrintF(filename, "%s-%p-%i", file_prefix,
reinterpret_cast<void*>(info->shared_info()->address()),
optimization_id);
} else { } else {
SNPrintF(filename, "turbo-none-%i", optimization_id); SNPrintF(filename, "%s-none-%i", file_prefix, optimization_id);
} }
base::EmbeddedVector<char, 256> source_file(0); base::EmbeddedVector<char, 256> source_file(0);
bool source_available = false; bool source_available = false;

View File

@ -839,6 +839,8 @@ DEFINE_STRING(trace_turbo_filter, "*",
DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs") DEFINE_BOOL(trace_turbo_graph, false, "trace generated TurboFan graphs")
DEFINE_BOOL(trace_turbo_scheduled, false, "trace TurboFan IR with schedule") DEFINE_BOOL(trace_turbo_scheduled, false, "trace TurboFan IR with schedule")
DEFINE_IMPLICATION(trace_turbo_scheduled, trace_turbo_graph) DEFINE_IMPLICATION(trace_turbo_scheduled, trace_turbo_graph)
DEFINE_STRING(trace_turbo_file_prefix, "turbo",
"trace turbo graph to a file with given prefix")
DEFINE_STRING(trace_turbo_cfg_file, nullptr, DEFINE_STRING(trace_turbo_cfg_file, nullptr,
"trace turbo cfg graph (for C1 visualizer) to a given file name") "trace turbo cfg graph (for C1 visualizer) to a given file name")
DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types") DEFINE_BOOL(trace_turbo_types, true, "trace TurboFan's types")

View File

@ -144,6 +144,7 @@ window.onload = function () {
if (uploadFile) { if (uploadFile) {
const fileReader = new FileReader(); const fileReader = new FileReader();
fileReader.onload = () => { fileReader.onload = () => {
document.title = uploadFile.name.replace(".json", "");
const txtRes = fileReader.result; const txtRes = fileReader.result;
if (typeof txtRes === "string") { if (typeof txtRes === "string") {
loadFile(txtRes); loadFile(txtRes);