@@ -29,46 +29,40 @@ impl flags::Metrics {
29
29
30
30
let _env = sh. push_env ( "RA_METRICS" , "1" ) ;
31
31
32
- let filename = match self . measurement_type {
33
- Some ( ms) => match ms {
34
- MeasurementType :: Build => {
35
- metrics. measure_build ( sh) ?;
36
- "build.json"
37
- }
38
- MeasurementType :: AnalyzeSelf => {
39
- metrics. measure_analysis_stats_self ( sh) ?;
40
- "self.json"
41
- }
42
- MeasurementType :: AnalyzeRipgrep => {
43
- metrics. measure_analysis_stats ( sh, "ripgrep" ) ?;
44
- "ripgrep.json"
45
- }
46
- MeasurementType :: AnalyzeWebRender => {
47
- {
48
- // https://github.com/rust-lang/rust-analyzer/issues/9997
49
- let _d = sh. push_dir ( "target/rustc-perf/collector/benchmarks/webrender" ) ;
50
- cmd ! ( sh, "cargo update -p url --precise 1.6.1" ) . run ( ) ?;
32
+ let name = match & self . measurement_type {
33
+ Some ( ms) => {
34
+ let name = ms. as_ref ( ) ;
35
+ match ms {
36
+ MeasurementType :: Build => {
37
+ metrics. measure_build ( sh) ?;
51
38
}
52
- metrics. measure_analysis_stats ( sh, "webrender" ) ?;
53
- "webrender.json"
54
- }
55
- MeasurementType :: AnalyzeDiesel => {
56
- metrics. measure_analysis_stats ( sh, "diesel/diesel" ) ?;
57
- "diesel.json"
58
- }
59
- } ,
39
+ MeasurementType :: AnalyzeSelf => {
40
+ metrics. measure_analysis_stats_self ( sh) ?;
41
+ }
42
+ MeasurementType :: AnalyzeRipgrep => {
43
+ metrics. measure_analysis_stats ( sh, name) ?;
44
+ }
45
+ MeasurementType :: AnalyzeWebRender => {
46
+ metrics. measure_analysis_stats ( sh, name) ?;
47
+ }
48
+ MeasurementType :: AnalyzeDiesel => {
49
+ metrics. measure_analysis_stats ( sh, name) ?;
50
+ }
51
+ } ;
52
+ name
53
+ }
60
54
None => {
61
55
metrics. measure_build ( sh) ?;
62
56
metrics. measure_analysis_stats_self ( sh) ?;
63
- metrics. measure_analysis_stats ( sh, "ripgrep" ) ?;
64
- metrics. measure_analysis_stats ( sh, "webrender" ) ?;
65
- metrics. measure_analysis_stats ( sh, "diesel/diesel" ) ?;
66
- "all.json "
57
+ metrics. measure_analysis_stats ( sh, MeasurementType :: AnalyzeRipgrep . as_ref ( ) ) ?;
58
+ metrics. measure_analysis_stats ( sh, MeasurementType :: AnalyzeWebRender . as_ref ( ) ) ?;
59
+ metrics. measure_analysis_stats ( sh, MeasurementType :: AnalyzeDiesel . as_ref ( ) ) ?;
60
+ "all"
67
61
}
68
62
} ;
69
63
70
64
let mut file =
71
- fs:: File :: options ( ) . write ( true ) . create ( true ) . open ( format ! ( "target/{}" , filename ) ) ?;
65
+ fs:: File :: options ( ) . write ( true ) . create ( true ) . open ( format ! ( "target/{}.json " , name ) ) ?;
72
66
writeln ! ( file, "{}" , metrics. json( ) ) ?;
73
67
eprintln ! ( "{metrics:#?}" ) ;
74
68
Ok ( ( ) )
@@ -93,7 +87,7 @@ impl Metrics {
93
87
self . measure_analysis_stats_path (
94
88
sh,
95
89
bench,
96
- & format ! ( "./target/rustc-perf/collector/benchmarks/{bench}" ) ,
90
+ & format ! ( "./target/rustc-perf/collector/compile- benchmarks/{bench}" ) ,
97
91
)
98
92
}
99
93
fn measure_analysis_stats_path (
@@ -102,6 +96,7 @@ impl Metrics {
102
96
name : & str ,
103
97
path : & str ,
104
98
) -> anyhow:: Result < ( ) > {
99
+ assert ! ( Path :: new( path) . exists( ) , "unable to find bench in {path}" ) ;
105
100
eprintln ! ( "\n Measuring analysis-stats/{name}" ) ;
106
101
let output = cmd ! ( sh, "./target/release/rust-analyzer -q analysis-stats {path}" ) . read ( ) ?;
107
102
for ( metric, value, unit) in parse_metrics ( & output) {
@@ -145,7 +140,7 @@ impl Metrics {
145
140
let host = Host :: new ( sh) ?;
146
141
let timestamp = SystemTime :: now ( ) ;
147
142
let revision = cmd ! ( sh, "git rev-parse HEAD" ) . read ( ) ?;
148
- let perf_revision = "c52ee623e231e7690a93be88d943016968c1036b " . into ( ) ;
143
+ let perf_revision = "a584462e145a0c04760fd9391daefb4f6bd13a99 " . into ( ) ;
149
144
Ok ( Metrics { host, timestamp, revision, perf_revision, metrics : BTreeMap :: new ( ) } )
150
145
}
151
146
0 commit comments