File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,16 @@ fn main() {
83
83
}
84
84
85
85
"xperf-stat" | "xperf-stat-self-profile" => {
86
- // Read the path to tracelog.exe from either an environment variable, falling back to assuming it's on the PATH.
86
+ // Read the path to xperf.exe and tracelog.exe from an environment variable, falling back to assuming it's on the PATH.
87
+ let xperf = std:: env:: var ( "XPERF" ) . unwrap_or ( "xperf.exe" . to_string ( ) ) ;
88
+ let mut cmd = Command :: new ( & xperf) ;
89
+ assert ! ( cmd. output( ) . is_ok( ) , "xperf.exe could not be started" ) ;
90
+
91
+ // go ahead and run xperf -stop counters in case there are leftover counters running from a failed prior attempt
92
+ let mut cmd = Command :: new ( & xperf) ;
93
+ cmd. args ( & [ "-stop" , "counters" ] ) ;
94
+ cmd. status ( ) . expect ( "failed to spawn xperf" ) ;
95
+
87
96
let tracelog = std:: env:: var ( "TRACELOG" ) . unwrap_or ( "tracelog.exe" . to_string ( ) ) ;
88
97
let mut cmd = Command :: new ( tracelog) ;
89
98
assert ! ( cmd. output( ) . is_ok( ) , "tracelog.exe could not be started" ) ;
@@ -115,10 +124,6 @@ fn main() {
115
124
dur. subsec_nanos( )
116
125
) ;
117
126
118
- let xperf = std:: env:: var ( "XPERF" ) . unwrap_or ( "xperf.exe" . to_string ( ) ) ;
119
- let mut cmd = Command :: new ( & xperf) ;
120
- assert ! ( cmd. output( ) . is_ok( ) , "xperf.exe could not be started" ) ;
121
-
122
127
let xperf = |args : & [ & str ] | {
123
128
let mut cmd = Command :: new ( & xperf) ;
124
129
cmd. args ( args) ;
You can’t perform that action at this time.
0 commit comments