@@ -230,7 +230,7 @@ impl Profiler {
230
230
231
231
// What cargo subcommand do we need to run for this profiler? If not
232
232
// `rustc`, must be a subcommand that itself invokes `rustc`.
233
- fn subcommand ( & self , build_kind : ProfileKind ) -> Option < & ' static str > {
233
+ fn subcommand ( & self , profile_kind : ProfileKind ) -> Option < & ' static str > {
234
234
match self {
235
235
Profiler :: PerfStat
236
236
| Profiler :: PerfStatSelfProfile
@@ -247,13 +247,13 @@ impl Profiler {
247
247
| Profiler :: DepGraph
248
248
| Profiler :: MonoItems
249
249
| Profiler :: Eprintln => {
250
- if build_kind == ProfileKind :: Doc {
250
+ if profile_kind == ProfileKind :: Doc {
251
251
Some ( "rustdoc" )
252
252
} else {
253
253
Some ( "rustc" )
254
254
}
255
255
}
256
- Profiler :: LlvmLines => match build_kind {
256
+ Profiler :: LlvmLines => match profile_kind {
257
257
ProfileKind :: Debug | ProfileKind :: Opt => Some ( "llvm-lines" ) ,
258
258
ProfileKind :: Check | ProfileKind :: Doc => None ,
259
259
} ,
@@ -286,7 +286,7 @@ impl Profiler {
286
286
struct CargoProcess < ' a > {
287
287
compiler : Compiler < ' a > ,
288
288
cwd : & ' a Path ,
289
- build_kind : ProfileKind ,
289
+ profile_kind : ProfileKind ,
290
290
incremental : bool ,
291
291
processor_etc : Option < (
292
292
& ' a mut dyn Processor ,
@@ -361,9 +361,9 @@ impl<'a> CargoProcess<'a> {
361
361
// really.
362
362
fn run_rustc ( & mut self , needs_final : bool ) -> anyhow:: Result < ( ) > {
363
363
log:: info!(
364
- "run_rustc with incremental={}, build_kind ={:?}, scenario_kind={:?}, patch={:?}" ,
364
+ "run_rustc with incremental={}, profile_kind ={:?}, scenario_kind={:?}, patch={:?}" ,
365
365
self . incremental,
366
- self . build_kind ,
366
+ self . profile_kind ,
367
367
self . processor_etc. as_ref( ) . map( |v| v. 1 ) ,
368
368
self . processor_etc. as_ref( ) . and_then( |v| v. 3 )
369
369
) ;
@@ -374,33 +374,33 @@ impl<'a> CargoProcess<'a> {
374
374
// machinery works).
375
375
let subcommand =
376
376
if let Some ( ( ref mut processor, scenario_kind, ..) ) = self . processor_etc {
377
- let profiler = processor. profiler ( self . build_kind ) ;
377
+ let profiler = processor. profiler ( self . profile_kind ) ;
378
378
if !profiler. is_scenario_kind_allowed ( scenario_kind) {
379
379
return Err ( anyhow:: anyhow!(
380
380
"this profiler doesn't support {:?} scenarios" ,
381
381
scenario_kind
382
382
) ) ;
383
383
}
384
384
385
- match profiler. subcommand ( self . build_kind ) {
385
+ match profiler. subcommand ( self . profile_kind ) {
386
386
None => {
387
387
return Err ( anyhow:: anyhow!(
388
- "this profiler doesn't support {:?} builds " ,
389
- self . build_kind
388
+ "this profiler doesn't support the {:?} profile " ,
389
+ self . profile_kind
390
390
) )
391
391
}
392
392
Some ( sub) => sub,
393
393
}
394
394
} else {
395
- match self . build_kind {
395
+ match self . profile_kind {
396
396
ProfileKind :: Doc => "rustdoc" ,
397
397
_ => "rustc" ,
398
398
}
399
399
} ;
400
400
401
401
let mut cmd = self . base_command ( self . cwd , subcommand) ;
402
402
cmd. arg ( "-p" ) . arg ( self . get_pkgid ( self . cwd ) ?) ;
403
- match self . build_kind {
403
+ match self . profile_kind {
404
404
ProfileKind :: Check => {
405
405
cmd. arg ( "--profile" ) . arg ( "check" ) ;
406
406
}
@@ -428,7 +428,7 @@ impl<'a> CargoProcess<'a> {
428
428
. as_mut ( )
429
429
. map ( |v| & mut v. 0 )
430
430
. expect ( "needs_final needs a processor" ) ;
431
- let profiler = processor. profiler ( self . build_kind ) . name ( ) ;
431
+ let profiler = processor. profiler ( self . profile_kind ) . name ( ) ;
432
432
// If we're using a processor, we expect that only the crate
433
433
// we're interested in benchmarking will be built, not any
434
434
// dependencies.
@@ -484,7 +484,7 @@ impl<'a> CargoProcess<'a> {
484
484
let data = ProcessOutputData {
485
485
name : self . processor_name . clone ( ) ,
486
486
cwd : self . cwd ,
487
- build_kind : self . build_kind ,
487
+ profile_kind : self . profile_kind ,
488
488
scenario_kind,
489
489
scenario_kind_str,
490
490
patch,
@@ -534,7 +534,7 @@ pub enum Retry {
534
534
pub struct ProcessOutputData < ' a > {
535
535
name : BenchmarkName ,
536
536
cwd : & ' a Path ,
537
- build_kind : ProfileKind ,
537
+ profile_kind : ProfileKind ,
538
538
scenario_kind : ScenarioKind ,
539
539
scenario_kind_str : & ' a str ,
540
540
patch : Option < & ' a Patch > ,
@@ -626,7 +626,7 @@ impl<'a> MeasureProcessor<'a> {
626
626
fn insert_stats (
627
627
& mut self ,
628
628
scenario : database:: Scenario ,
629
- build_kind : ProfileKind ,
629
+ profile_kind : ProfileKind ,
630
630
stats : ( Stats , Option < SelfProfile > , Option < SelfProfileFiles > ) ,
631
631
) {
632
632
let version = String :: from_utf8 (
@@ -642,7 +642,7 @@ impl<'a> MeasureProcessor<'a> {
642
642
. unwrap ( ) ;
643
643
644
644
let collection = self . rt . block_on ( self . conn . collection_id ( & version) ) ;
645
- let profile = match build_kind {
645
+ let profile = match profile_kind {
646
646
ProfileKind :: Check => database:: Profile :: Check ,
647
647
ProfileKind :: Debug => database:: Profile :: Debug ,
648
648
ProfileKind :: Doc => database:: Profile :: Doc ,
@@ -806,7 +806,7 @@ impl Upload {
806
806
}
807
807
808
808
impl < ' a > Processor for MeasureProcessor < ' a > {
809
- fn profiler ( & self , _build : ProfileKind ) -> Profiler {
809
+ fn profiler ( & self , _profile : ProfileKind ) -> Profiler {
810
810
if self . is_first_collection && self . is_self_profile {
811
811
if cfg ! ( unix) {
812
812
Profiler :: PerfStatSelfProfile
@@ -826,11 +826,11 @@ impl<'a> Processor for MeasureProcessor<'a> {
826
826
self . is_first_collection = true ;
827
827
}
828
828
829
- fn finished_first_collection ( & mut self , build : ProfileKind ) -> bool {
830
- let original = self . profiler ( build ) ;
829
+ fn finished_first_collection ( & mut self , profile : ProfileKind ) -> bool {
830
+ let original = self . profiler ( profile ) ;
831
831
self . is_first_collection = false ;
832
832
// We need to run again if we're going to use a different profiler
833
- self . profiler ( build ) != original
833
+ self . profiler ( profile ) != original
834
834
}
835
835
836
836
fn process_output (
@@ -842,27 +842,27 @@ impl<'a> Processor for MeasureProcessor<'a> {
842
842
Ok ( res) => {
843
843
match data. scenario_kind {
844
844
ScenarioKind :: Full => {
845
- self . insert_stats ( database:: Scenario :: Empty , data. build_kind , res) ;
845
+ self . insert_stats ( database:: Scenario :: Empty , data. profile_kind , res) ;
846
846
}
847
847
ScenarioKind :: IncrFull => {
848
848
self . insert_stats (
849
849
database:: Scenario :: IncrementalEmpty ,
850
- data. build_kind ,
850
+ data. profile_kind ,
851
851
res,
852
852
) ;
853
853
}
854
854
ScenarioKind :: IncrUnchanged => {
855
855
self . insert_stats (
856
856
database:: Scenario :: IncrementalFresh ,
857
- data. build_kind ,
857
+ data. profile_kind ,
858
858
res,
859
859
) ;
860
860
}
861
861
ScenarioKind :: IncrPatched => {
862
862
let patch = data. patch . unwrap ( ) ;
863
863
self . insert_stats (
864
864
database:: Scenario :: IncrementalPatch ( patch. name ) ,
865
- data. build_kind ,
865
+ data. profile_kind ,
866
866
res,
867
867
) ;
868
868
}
@@ -934,7 +934,7 @@ impl<'a> Processor for ProfileProcessor<'a> {
934
934
let out_file = |prefix : & str | -> String {
935
935
format ! (
936
936
"{}-{}-{}-{:?}-{}" ,
937
- prefix, self . id, data. name, data. build_kind , data. scenario_kind_str
937
+ prefix, self . id, data. name, data. profile_kind , data. scenario_kind_str
938
938
)
939
939
} ;
940
940
@@ -1292,7 +1292,7 @@ impl Benchmark {
1292
1292
& ' a self ,
1293
1293
compiler : Compiler < ' a > ,
1294
1294
cwd : & ' a Path ,
1295
- build_kind : ProfileKind ,
1295
+ profile_kind : ProfileKind ,
1296
1296
) -> CargoProcess < ' a > {
1297
1297
let mut cargo_args = self
1298
1298
. config
@@ -1313,7 +1313,7 @@ impl Benchmark {
1313
1313
compiler,
1314
1314
processor_name : self . name . clone ( ) ,
1315
1315
cwd,
1316
- build_kind ,
1316
+ profile_kind ,
1317
1317
incremental : false ,
1318
1318
processor_etc : None ,
1319
1319
manifest_path : self
@@ -1339,7 +1339,7 @@ impl Benchmark {
1339
1339
pub fn measure (
1340
1340
& self ,
1341
1341
processor : & mut dyn Processor ,
1342
- build_kinds : & [ ProfileKind ] ,
1342
+ profile_kinds : & [ ProfileKind ] ,
1343
1343
scenario_kinds : & [ ScenarioKind ] ,
1344
1344
compiler : Compiler < ' _ > ,
1345
1345
iterations : Option < usize > ,
@@ -1350,13 +1350,13 @@ impl Benchmark {
1350
1350
return processor. measure_rustc ( compiler) . context ( "measure rustc" ) ;
1351
1351
}
1352
1352
1353
- if self . config . disabled || build_kinds . is_empty ( ) {
1353
+ if self . config . disabled || profile_kinds . is_empty ( ) {
1354
1354
eprintln ! ( "Skipping {}: disabled" , self . name) ;
1355
1355
bail ! ( "disabled benchmark" ) ;
1356
1356
}
1357
1357
1358
1358
eprintln ! ( "Preparing {}" , self . name) ;
1359
- let build_kind_dirs = build_kinds
1359
+ let profile_kind_dirs = profile_kinds
1360
1360
. iter ( )
1361
1361
. map ( |kind| Ok ( ( * kind, self . make_temp_dir ( & self . path ) ?) ) )
1362
1362
. collect :: < anyhow:: Result < Vec < _ > > > ( ) ?;
@@ -1385,10 +1385,10 @@ impl Benchmark {
1385
1385
// target-directory global lock during compilation.
1386
1386
crossbeam_utils:: thread:: scope :: < _ , anyhow:: Result < ( ) > > ( |s| {
1387
1387
let server = jobserver:: Client :: new ( num_cpus:: get ( ) ) . context ( "jobserver::new" ) ?;
1388
- for ( build_kind , prep_dir) in & build_kind_dirs {
1388
+ for ( profile_kind , prep_dir) in & profile_kind_dirs {
1389
1389
let server = server. clone ( ) ;
1390
1390
s. spawn :: < _ , anyhow:: Result < ( ) > > ( move |_| {
1391
- self . mk_cargo_process ( compiler, prep_dir. path ( ) , * build_kind )
1391
+ self . mk_cargo_process ( compiler, prep_dir. path ( ) , * profile_kind )
1392
1392
. jobserver ( server)
1393
1393
. run_rustc ( false ) ?;
1394
1394
Ok ( ( ) )
@@ -1398,18 +1398,18 @@ impl Benchmark {
1398
1398
} )
1399
1399
. unwrap ( ) ?;
1400
1400
1401
- for ( build_kind , prep_dir) in build_kind_dirs {
1401
+ for ( profile_kind , prep_dir) in profile_kind_dirs {
1402
1402
eprintln ! (
1403
1403
"Running {}: {:?} + {:?}" ,
1404
- self . name, build_kind , scenario_kinds
1404
+ self . name, profile_kind , scenario_kinds
1405
1405
) ;
1406
1406
1407
1407
// We want at least two runs for all benchmarks (since we run
1408
1408
// self-profile separately).
1409
1409
processor. start_first_collection ( ) ;
1410
1410
for i in 0 ..cmp:: max ( iterations, 2 ) {
1411
1411
if i == 1 {
1412
- let different = processor. finished_first_collection ( build_kind ) ;
1412
+ let different = processor. finished_first_collection ( profile_kind ) ;
1413
1413
if iterations == 1 && !different {
1414
1414
// Don't run twice if this processor doesn't need it and
1415
1415
// we've only been asked to run once.
@@ -1423,28 +1423,25 @@ impl Benchmark {
1423
1423
1424
1424
// A full non-incremental build.
1425
1425
if scenario_kinds. contains ( & ScenarioKind :: Full ) {
1426
- self . mk_cargo_process ( compiler, cwd, build_kind )
1426
+ self . mk_cargo_process ( compiler, cwd, profile_kind )
1427
1427
. processor ( processor, ScenarioKind :: Full , "Full" , None )
1428
1428
. run_rustc ( true ) ?;
1429
1429
}
1430
1430
1431
1431
// Rustdoc does not support incremental compilation
1432
- if build_kind != ProfileKind :: Doc {
1433
- // An incremental build from scratch (slowest incremental case).
1432
+ if profile_kind != ProfileKind :: Doc {
1433
+ // An incremental from scratch (slowest incremental case).
1434
1434
// This is required for any subsequent incremental builds.
1435
- if scenario_kinds. contains ( & ScenarioKind :: IncrFull )
1436
- || scenario_kinds. contains ( & ScenarioKind :: IncrUnchanged )
1437
- || scenario_kinds. contains ( & ScenarioKind :: IncrPatched )
1438
- {
1439
- self . mk_cargo_process ( compiler, cwd, build_kind)
1435
+ if scenario_kinds. iter ( ) . any ( |s| s. is_incr ( ) ) {
1436
+ self . mk_cargo_process ( compiler, cwd, profile_kind)
1440
1437
. incremental ( true )
1441
1438
. processor ( processor, ScenarioKind :: IncrFull , "IncrFull" , None )
1442
1439
. run_rustc ( true ) ?;
1443
1440
}
1444
1441
1445
1442
// An incremental build with no changes (fastest incremental case).
1446
1443
if scenario_kinds. contains ( & ScenarioKind :: IncrUnchanged ) {
1447
- self . mk_cargo_process ( compiler, cwd, build_kind )
1444
+ self . mk_cargo_process ( compiler, cwd, profile_kind )
1448
1445
. incremental ( true )
1449
1446
. processor (
1450
1447
processor,
@@ -1463,7 +1460,7 @@ impl Benchmark {
1463
1460
// An incremental build with some changes (realistic
1464
1461
// incremental case).
1465
1462
let scenario_kind_str = format ! ( "IncrPatched{}" , i) ;
1466
- self . mk_cargo_process ( compiler, cwd, build_kind )
1463
+ self . mk_cargo_process ( compiler, cwd, profile_kind )
1467
1464
. incremental ( true )
1468
1465
. processor (
1469
1466
processor,
0 commit comments