Skip to content

Commit e0cef24

Browse files
authored
Merge pull request #18762 from graydon/num-instructions-executed
2 parents 95e9879 + fe5667a commit e0cef24

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

include/swift/Basic/Statistics.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ DRIVER_STATISTIC(ChildrenMaxRSS)
8080
/// EXIT_SUCCESS.
8181
FRONTEND_STATISTIC(Frontend, NumProcessFailures)
8282

83-
/// Total instruction count in each frontend process.
84-
FRONTEND_STATISTIC(Frontend, NumInstructions)
83+
/// Total instructions-executed count in each frontend process.
84+
FRONTEND_STATISTIC(Frontend, NumInstructionsExecuted)
8585

8686
/// Number of source buffers visible in the source manager.
8787
FRONTEND_STATISTIC(AST, NumSourceBuffers)

lib/Basic/Statistic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ void updateProcessWideFrontendCounters(
492492
#if defined(HAVE_PROC_PID_RUSAGE) && defined(RUSAGE_INFO_V4)
493493
struct rusage_info_v4 ru;
494494
if (0 == proc_pid_rusage(getpid(), RUSAGE_INFO_V4, (rusage_info_t *)&ru)) {
495-
C.NumInstructions = ru.ri_instructions;
495+
C.NumInstructionsExecuted = ru.ri_instructions;
496496
}
497497
#endif
498498
}

test/Misc/stats_dir_instructions.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// RUN: %target-swiftc_driver -o %t/main -module-name main -stats-output-dir %t %s
44
// RUN: %{python} %utils/process-stats-dir.py --set-csv-baseline %t/frontend.csv %t
55
// RUN: %FileCheck -input-file %t/frontend.csv %s
6-
// CHECK: {{"Frontend.NumInstructions" [1-9][0-9]*$}}
6+
//
7+
// Note: this may be zero if we're on a machine with no hardware counters (eg. a VM)
8+
// CHECK: {{"Frontend.NumInstructionsExecuted" [0-9]*$}}
79

810
public func foo() {
911
print("hello")

0 commit comments

Comments
 (0)