@@ -178,8 +178,7 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
178
178
def name : String = this .toString().toLowerCase()
179
179
case Run , Phase , File , TypeCheck , Implicit , Macro , Completion
180
180
private [profile] val chromeTrace =
181
- if ctx.settings.YprofileTrace .isDefault
182
- then null
181
+ if ctx.settings.YprofileTrace .isDefault then null
183
182
else
184
183
val filename = ctx.settings.YprofileTrace .value
185
184
// Compilation units requiring multi-stage compilation (macros) would create a new profiler instances
@@ -312,43 +311,42 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
312
311
override def afterMacroSplice (event : TracedEventId ): Unit = traceDurationEnd(Category .Macro , event, colour = " olive" )
313
312
314
313
override def beforeCompletion (root : Symbol , associatedFile : => AbstractFile ): (TracedEventId , String ) =
315
- if chromeTrace == null
316
- then (TracedEventId .Empty , " " )
314
+ if chromeTrace == null then
315
+ (TracedEventId .Empty , " " )
317
316
else
318
317
val file = associatedFile
319
- val completionName = this .completionName(root, file)
318
+ val completionName = this .completionName(root, file)
320
319
val event = TracedEventId (file.name)
321
320
chromeTrace.traceDurationEventStart(Category .Completion .name, " ↯" , colour = " thread_state_sleeping" )
322
321
chromeTrace.traceDurationEventStart(Category .File .name, event)
323
322
chromeTrace.traceDurationEventStart(Category .Completion .name, completionName)
324
323
(event, completionName)
325
324
326
325
override def afterCompletion (event : TracedEventId , completionName : String ): Unit =
327
- if chromeTrace != null
328
- then
326
+ if chromeTrace != null then
329
327
chromeTrace.traceDurationEventEnd(Category .Completion .name, completionName)
330
328
chromeTrace.traceDurationEventEnd(Category .File .name, event)
331
329
chromeTrace.traceDurationEventEnd(Category .Completion .name, " ↯" , colour = " thread_state_sleeping" )
332
330
333
331
334
- private inline def traceDurationStart (category : Category , inline eventName : String , colour : String = " " ): TracedEventId =
335
- if chromeTrace == null
336
- then TracedEventId .Empty
332
+ private inline def traceDurationStart (inline category : Category , inline eventName : String , inline colour : String = " " ): TracedEventId =
333
+ if chromeTrace == null then
334
+ TracedEventId .Empty
337
335
else
338
336
val event = TracedEventId (eventName)
339
337
chromeTrace.traceDurationEventStart(category.name, event, colour)
340
338
event
341
339
342
- private inline def traceDurationEnd (category : Category , event : TracedEventId , colour : String = " " ): Unit =
343
- if chromeTrace != null
344
- then chromeTrace.traceDurationEventEnd(category.name, event, colour)
340
+ private inline def traceDurationEnd (inline category : Category , inline event : TracedEventId , inline colour : String = " " ): Unit =
341
+ if chromeTrace != null then
342
+ chromeTrace.traceDurationEventEnd(category.name, event, colour)
345
343
346
344
347
345
private def symbolName (sym : Symbol ): String = s " ${sym.showKind} ${sym.showName}"
348
346
private def completionName (root : Symbol , associatedFile : AbstractFile ): String =
349
347
def isTopLevel = root.owner != NoSymbol && root.owner.is(Flags .Package )
350
- if root.is(Flags .Package ) || isTopLevel
351
- then root.javaBinaryName
348
+ if root.is(Flags .Package ) || isTopLevel then
349
+ root.javaBinaryName
352
350
else
353
351
val enclosing = root.enclosingClass
354
352
s " ${enclosing.javaBinaryName}:: ${root.name}"
0 commit comments