Skip to content

Commit d76f5d7

Browse files
committed
wip
1 parent f50da8f commit d76f5d7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/compiler/scala/tools/nsc/Global.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
12731273
checkPhaseSettings(including = false, exclusions map (_.value): _*)
12741274

12751275
// Report the overhead of statistics measurements per every run
1276-
if (settings.areStatisticsEnabled)
1276+
if (settings.areStatisticsEnabled && settings.Ystatistics.value.nonEmpty)
12771277
statistics.reportStatisticsOverhead(reporter)
12781278

12791279
phase = first //parserPhase
@@ -1576,7 +1576,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
15761576
}
15771577
symSource.keys foreach (x => resetPackageClass(x.owner))
15781578

1579-
if (timePhases) {
1579+
if (timePhases && settings.Ystatistics.value.nonEmpty) {
15801580
statistics.stopTimer(totalCompileTime, startTotal)
15811581
informTime("total", totalCompileTime.nanos)
15821582
inform("*** Cumulative timers for phases")

src/compiler/scala/tools/nsc/settings/ScalaSettings.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,16 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
419419

420420
val YoptLogInline = StringSetting("-Yopt-log-inline", "package/Class.method", "Print a summary of inliner activity; `_` to print all, prefix match to select.", "")
421421

422-
val Ystatistics = PhasesSetting("-Ystatistics", "Print compiler statistics for specific phases", "parser,typer,patmat,erasure,cleanup,jvm")
422+
val Ystatistics = PhasesSetting("-Ystatistics", "Print compiler statistics for specific phases (implies `-Ycollect-statistics`)", "parser,typer,patmat,erasure,cleanup,jvm")
423423
.withPostSetHook(s => if (s.value.nonEmpty) StatisticsStatics.enableColdStatsAndDeoptimize())
424424

425+
val YcollectStatistics = BooleanSetting("-Ycollect-statistics", "Collect cold statistics (quietly, unless `-Ystatistics` is set)")
426+
.withPostSetHook(s => if (s.value) StatisticsStatics.enableColdStatsAndDeoptimize())
427+
425428
val YhotStatistics = BooleanSetting("-Yhot-statistics-enabled", s"Enable `${Ystatistics.name}` to print hot statistics.")
426429
.withPostSetHook(s => if (s && YstatisticsEnabled) StatisticsStatics.enableHotStatsAndDeoptimize())
427430

428-
override def YstatisticsEnabled = Ystatistics.value.nonEmpty
431+
override def YstatisticsEnabled = Ystatistics.value.nonEmpty || YcollectStatistics.value
429432
override def YhotStatisticsEnabled = YhotStatistics.value
430433

431434
val YprofileEnabled = BooleanSetting("-Yprofile-enabled", "Enable profiling.")

0 commit comments

Comments
 (0)