File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ fn main() {
83
83
}
84
84
85
85
"xperf-stat" | "xperf-stat-self-profile" => {
86
+ // For Windows, we use a combination of xperf and tracelog to capture ETW events including hardware performance counters.
87
+ // To do this, we start an ETW trace using tracelog, telling it to include the InstructionRetired and TotalCycles PMCs
88
+ // for each CSwitch event that is recorded. Then when ETW records a context switch event, it will be preceeded by a
89
+ // PMC event which contains the raw counters at that instant. After we've finished compilation, we then use xperf
90
+ // to stop the trace and dump the results to a plain text file. This file is then processed by the `etw_parser` module
91
+ // which finds events related to the rustc process and calculates the total values for those performance counters.
92
+ // Conceptually, this is similar to how `perf` works on Linux except we have to do more of the work ourselves as there
93
+ // isn't an out of the box way to get the data we care about.
94
+
86
95
// Read the path to xperf.exe and tracelog.exe from an environment variable, falling back to assuming it's on the PATH.
87
96
let xperf = std:: env:: var ( "XPERF" ) . unwrap_or ( "xperf.exe" . to_string ( ) ) ;
88
97
let mut cmd = Command :: new ( & xperf) ;
You can’t perform that action at this time.
0 commit comments