From 16795d63f785cbba725d84cdab0b69be3941f331 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Fri, 12 Apr 2024 16:50:07 +0200 Subject: [PATCH] Apply code review suggestion, remove commented out code and prevent double evaluation of associatedFile --- compiler/src/dotty/tools/dotc/profile/Profiler.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/profile/Profiler.scala b/compiler/src/dotty/tools/dotc/profile/Profiler.scala index 77fec6757ac8..05ca33f893fd 100644 --- a/compiler/src/dotty/tools/dotc/profile/Profiler.scala +++ b/compiler/src/dotty/tools/dotc/profile/Profiler.scala @@ -234,10 +234,7 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context) import java.lang.{Integer => jInt} val reportNs = System.nanoTime() val data = notification.getUserData - // val seq = notification.getSequenceNumber - // val message = notification.getMessage val tpe = notification.getType - // val time= notification.getTimeStamp data match { case cd: CompositeData if tpe == "com.sun.management.gc.notification" => val name = cd.get("gcName").toString @@ -318,8 +315,9 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context) if chromeTrace == null then (TracedEventId.Empty, "") else - val completionName= this.completionName(root, associatedFile) - val event = TracedEventId(associatedFile.name) + val file = associatedFile + val completionName= this.completionName(root, file) + val event = TracedEventId(file.name) chromeTrace.traceDurationEventStart(Category.Completion.name, "↯", colour = "thread_state_sleeping") chromeTrace.traceDurationEventStart(Category.File.name, event) chromeTrace.traceDurationEventStart(Category.Completion.name, completionName)