1
1
//! Execute benchmarks.
2
2
3
- use crate :: { BuildKind , Compiler , ScenarioKind } ;
3
+ use crate :: { Compiler , ProfileKind , ScenarioKind } ;
4
4
use anyhow:: { anyhow, bail, Context } ;
5
5
use collector:: command_output;
6
6
use collector:: etw_parser;
@@ -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 : BuildKind ) -> Option < & ' static str > {
233
+ fn subcommand ( & self , build_kind : ProfileKind ) -> Option < & ' static str > {
234
234
match self {
235
235
Profiler :: PerfStat
236
236
| Profiler :: PerfStatSelfProfile
@@ -247,15 +247,15 @@ impl Profiler {
247
247
| Profiler :: DepGraph
248
248
| Profiler :: MonoItems
249
249
| Profiler :: Eprintln => {
250
- if build_kind == BuildKind :: Doc {
250
+ if build_kind == ProfileKind :: Doc {
251
251
Some ( "rustdoc" )
252
252
} else {
253
253
Some ( "rustc" )
254
254
}
255
255
}
256
256
Profiler :: LlvmLines => match build_kind {
257
- BuildKind :: Debug | BuildKind :: Opt => Some ( "llvm-lines" ) ,
258
- BuildKind :: Check | BuildKind :: Doc => None ,
257
+ ProfileKind :: Debug | ProfileKind :: Opt => Some ( "llvm-lines" ) ,
258
+ ProfileKind :: Check | ProfileKind :: Doc => None ,
259
259
} ,
260
260
}
261
261
}
@@ -286,7 +286,7 @@ impl Profiler {
286
286
struct CargoProcess < ' a > {
287
287
compiler : Compiler < ' a > ,
288
288
cwd : & ' a Path ,
289
- build_kind : BuildKind ,
289
+ build_kind : ProfileKind ,
290
290
incremental : bool ,
291
291
processor_etc : Option < (
292
292
& ' a mut dyn Processor ,
@@ -393,20 +393,20 @@ impl<'a> CargoProcess<'a> {
393
393
}
394
394
} else {
395
395
match self . build_kind {
396
- BuildKind :: Doc => "rustdoc" ,
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
403
match self . build_kind {
404
- BuildKind :: Check => {
404
+ ProfileKind :: Check => {
405
405
cmd. arg ( "--profile" ) . arg ( "check" ) ;
406
406
}
407
- BuildKind :: Debug => { }
408
- BuildKind :: Doc => { }
409
- BuildKind :: Opt => {
407
+ ProfileKind :: Debug => { }
408
+ ProfileKind :: Doc => { }
409
+ ProfileKind :: Opt => {
410
410
cmd. arg ( "--release" ) ;
411
411
}
412
412
}
@@ -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 : BuildKind ,
537
+ build_kind : ProfileKind ,
538
538
scenario_kind : ScenarioKind ,
539
539
scenario_kind_str : & ' a str ,
540
540
patch : Option < & ' a Patch > ,
@@ -544,7 +544,7 @@ pub struct ProcessOutputData<'a> {
544
544
/// processing.
545
545
pub trait Processor {
546
546
/// The `Profiler` being used.
547
- fn profiler ( & self , _: BuildKind ) -> Profiler ;
547
+ fn profiler ( & self , _: ProfileKind ) -> Profiler ;
548
548
549
549
/// Process the output produced by the particular `Profiler` being used.
550
550
fn process_output (
@@ -563,7 +563,7 @@ pub trait Processor {
563
563
///
564
564
/// Return "true" if planning on doing something different for second
565
565
/// iteration.
566
- fn finished_first_collection ( & mut self , _: BuildKind ) -> bool {
566
+ fn finished_first_collection ( & mut self , _: ProfileKind ) -> bool {
567
567
false
568
568
}
569
569
@@ -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 : BuildKind ,
629
+ build_kind : ProfileKind ,
630
630
stats : ( Stats , Option < SelfProfile > , Option < SelfProfileFiles > ) ,
631
631
) {
632
632
let version = String :: from_utf8 (
@@ -643,10 +643,10 @@ impl<'a> MeasureProcessor<'a> {
643
643
644
644
let collection = self . rt . block_on ( self . conn . collection_id ( & version) ) ;
645
645
let profile = match build_kind {
646
- BuildKind :: Check => database:: Profile :: Check ,
647
- BuildKind :: Debug => database:: Profile :: Debug ,
648
- BuildKind :: Doc => database:: Profile :: Doc ,
649
- BuildKind :: Opt => database:: Profile :: Opt ,
646
+ ProfileKind :: Check => database:: Profile :: Check ,
647
+ ProfileKind :: Debug => database:: Profile :: Debug ,
648
+ ProfileKind :: Doc => database:: Profile :: Doc ,
649
+ ProfileKind :: Opt => database:: Profile :: Opt ,
650
650
} ;
651
651
652
652
if let Some ( files) = stats. 2 {
@@ -806,7 +806,7 @@ impl Upload {
806
806
}
807
807
808
808
impl < ' a > Processor for MeasureProcessor < ' a > {
809
- fn profiler ( & self , _build : BuildKind ) -> Profiler {
809
+ fn profiler ( & self , _build : ProfileKind ) -> Profiler {
810
810
if self . is_first_collection && self . is_self_profile {
811
811
if cfg ! ( unix) {
812
812
Profiler :: PerfStatSelfProfile
@@ -826,7 +826,7 @@ 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 : BuildKind ) -> bool {
829
+ fn finished_first_collection ( & mut self , build : ProfileKind ) -> bool {
830
830
let original = self . profiler ( build) ;
831
831
self . is_first_collection = false ;
832
832
// We need to run again if we're going to use a different profiler
@@ -919,7 +919,7 @@ impl<'a> ProfileProcessor<'a> {
919
919
}
920
920
921
921
impl < ' a > Processor for ProfileProcessor < ' a > {
922
- fn profiler ( & self , _: BuildKind ) -> Profiler {
922
+ fn profiler ( & self , _: ProfileKind ) -> Profiler {
923
923
self . profiler
924
924
}
925
925
@@ -1292,7 +1292,7 @@ impl Benchmark {
1292
1292
& ' a self ,
1293
1293
compiler : Compiler < ' a > ,
1294
1294
cwd : & ' a Path ,
1295
- build_kind : BuildKind ,
1295
+ build_kind : ProfileKind ,
1296
1296
) -> CargoProcess < ' a > {
1297
1297
let mut cargo_args = self
1298
1298
. config
@@ -1339,7 +1339,7 @@ impl Benchmark {
1339
1339
pub fn measure (
1340
1340
& self ,
1341
1341
processor : & mut dyn Processor ,
1342
- build_kinds : & [ BuildKind ] ,
1342
+ build_kinds : & [ ProfileKind ] ,
1343
1343
scenario_kinds : & [ ScenarioKind ] ,
1344
1344
compiler : Compiler < ' _ > ,
1345
1345
iterations : Option < usize > ,
@@ -1429,7 +1429,7 @@ impl Benchmark {
1429
1429
}
1430
1430
1431
1431
// Rustdoc does not support incremental compilation
1432
- if build_kind != BuildKind :: Doc {
1432
+ if build_kind != ProfileKind :: Doc {
1433
1433
// An incremental build from scratch (slowest incremental case).
1434
1434
// This is required for any subsequent incremental builds.
1435
1435
if scenario_kinds. contains ( & ScenarioKind :: IncrFull )
0 commit comments