Skip to content

Commit a25dd40

Browse files
committed
[Stats] Clear all timers on print, since they stopped self-clearing recently.
1 parent e661702 commit a25dd40

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/Basic/Statistic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ UnifiedStatsReporter::printAlwaysOnStatsAndTimers(raw_ostream &OS) {
444444
}
445445
// Print timers.
446446
TimerGroup::printAllJSONValues(OS, delim);
447+
TimerGroup::clearAll();
447448
OS << "\n}\n";
448449
OS.flush();
449450
}
@@ -664,6 +665,7 @@ UnifiedStatsReporter::~UnifiedStatsReporter()
664665
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
665666
publishAlwaysOnStatsToLLVM();
666667
PrintStatisticsJSON(ostream);
668+
TimerGroup::clearAll();
667669
#else
668670
printAlwaysOnStatsAndTimers(ostream);
669671
#endif

test/Misc/stats_dir.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
// RUN: %{python} %utils/process-stats-dir.py --compare-to-csv-baseline %t/driver.csv %t
2525

2626
// RUN: %target-swiftc_driver -c -o %t/out.o -stats-output-dir %t/this/is/not/a/directory %s 2>&1 | %FileCheck -check-prefix=CHECK-NODIR %s
27+
// RUN: %target-swiftc_driver -c -o %t/out.o -stats-output-dir %t %s 2>&1 | %FileCheck -allow-empty -check-prefix=CHECK-SILENT %s
2728

2829
// CHECK: {{"AST.NumSourceLines" [1-9][0-9]*$}}
2930
// CHECK: {{"IRModule.NumIRFunctions" [1-9][0-9]*$}}
3031
// CHECK: {{"LLVM.NumLLVMBytesOutput" [1-9][0-9]*$}}
3132

3233
// CHECK-NODIR: {{Error opening -stats-output-dir file}}
3334

35+
// CHECK-SILENT-NOT: {{---}}
36+
3437
public func foo() {
3538
print("hello")
3639
}

0 commit comments

Comments
 (0)