[maglev] Include compile time in --trace-opt

Bug: v8:7700
Change-Id: I2860bea3008ea1d357cf7e89fb0453221f065786
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3859344
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82747}
This commit is contained in:
Leszek Swirski 2022-08-26 14:33:20 +02:00 committed by V8 LUCI CQ
parent 8600d58092
commit 45019f34f3
2 changed files with 15 additions and 3 deletions

View File

@ -199,10 +199,14 @@ class CompilerTracer : public AllStatic {
}
static void TraceFinishMaglevCompile(Isolate* isolate,
Handle<JSFunction> function) {
Handle<JSFunction> function,
double ms_prepare, double ms_optimize,
double ms_codegen) {
if (!FLAG_trace_opt) return;
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintTracePrefix(scope, "completed compiling", function, CodeKind::MAGLEV);
PrintF(scope.file(), " - took %0.3f, %0.3f, %0.3f ms", ms_prepare,
ms_optimize, ms_codegen);
PrintTraceSuffix(scope);
}
@ -4011,7 +4015,11 @@ void Compiler::FinalizeMaglevCompilationJob(maglev::MaglevCompilationJob* job,
// function by MaglevCompilationJob::FinalizeJobImpl.
RecordMaglevFunctionCompilation(isolate, job->function());
CompilerTracer::TraceFinishMaglevCompile(isolate, job->function());
double ms_prepare = job->time_taken_to_prepare().InMillisecondsF();
double ms_optimize = job->time_taken_to_execute().InMillisecondsF();
double ms_codegen = job->time_taken_to_finalize().InMillisecondsF();
CompilerTracer::TraceFinishMaglevCompile(
isolate, job->function(), ms_prepare, ms_optimize, ms_codegen);
}
#endif
}

View File

@ -47,7 +47,7 @@ class MaglevCompilationJob final : public OptimizedCompilationJob {
public:
static std::unique_ptr<MaglevCompilationJob> New(Isolate* isolate,
Handle<JSFunction> function);
virtual ~MaglevCompilationJob();
~MaglevCompilationJob() override;
Status PrepareJobImpl(Isolate* isolate) override;
Status ExecuteJobImpl(RuntimeCallStats* stats,
@ -56,6 +56,10 @@ class MaglevCompilationJob final : public OptimizedCompilationJob {
Handle<JSFunction> function() const;
base::TimeDelta time_taken_to_prepare() { return time_taken_to_prepare_; }
base::TimeDelta time_taken_to_execute() { return time_taken_to_execute_; }
base::TimeDelta time_taken_to_finalize() { return time_taken_to_finalize_; }
private:
explicit MaglevCompilationJob(std::unique_ptr<MaglevCompilationInfo>&& info);