@@ -49,8 +49,6 @@ use crate::load::{Config, InputData};
49
49
use crate :: util:: { self , get_repo_path, Interpolate } ;
50
50
use collector:: api:: collected;
51
51
use collector:: version_supports_incremental;
52
- use collector:: BenchmarkName ;
53
- use collector:: CommitData ;
54
52
use collector:: Sha ;
55
53
use collector:: StatId ;
56
54
use parking_lot:: RwLock ;
@@ -612,23 +610,11 @@ pub async fn handle_collected(
612
610
}
613
611
614
612
fn get_self_profile_data (
615
- commit : & CommitData ,
613
+ benchmark : & collector :: Benchmark ,
616
614
bench_ty : & str ,
617
- bench_name : BenchmarkName ,
618
615
run_name : & str ,
619
616
sort_idx : Option < i32 > ,
620
617
) -> ServerResult < self_profile:: SelfProfile > {
621
- let benchmark = commit
622
- . benchmarks
623
- . get ( & bench_name)
624
- . ok_or ( format ! ( "No benchmark with name {}" , bench_name) ) ?;
625
- let benchmark = benchmark. as_ref ( ) . map_err ( |_| {
626
- format ! (
627
- "Benchmark {} did not compile successfully at this commit" ,
628
- bench_name
629
- )
630
- } ) ?;
631
-
632
618
let run = benchmark
633
619
. runs
634
620
. iter ( )
@@ -753,28 +739,15 @@ pub async fn handle_self_profile(
753
739
. ok ( )
754
740
. ok_or ( format ! ( "sort_idx needs to be i32" ) ) ?;
755
741
756
- let commit = data
757
- . data ( Interpolate :: No )
758
- . iter ( )
759
- . find ( |cd| cd. commit . sha == * body. commit )
760
- . ok_or ( format ! ( "could not find commit {}" , body. commit) ) ?;
761
- let profile = get_self_profile_data (
762
- & commit,
763
- bench_ty,
764
- bench_name,
765
- & body. run_name ,
766
- Some ( sort_idx) ,
767
- ) ?;
742
+ let benchmark =
743
+ data. benchmark_data ( Interpolate :: No , body. commit . as_str ( ) . into ( ) , bench_name) ?;
744
+ let profile = get_self_profile_data ( & benchmark, bench_ty, & body. run_name , Some ( sort_idx) ) ?;
768
745
let base_profile = if let Some ( bc) = body. base_commit {
769
- let base_commit = data
770
- . data ( Interpolate :: No )
771
- . iter ( )
772
- . find ( |cd| cd. commit . sha == * bc)
773
- . ok_or ( format ! ( "could not find commit {}" , bc) ) ?;
746
+ let base_benchmark =
747
+ data. benchmark_data ( Interpolate :: No , bc. as_str ( ) . into ( ) , bench_name) ?;
774
748
Some ( get_self_profile_data (
775
- & base_commit ,
749
+ & base_benchmark ,
776
750
bench_ty,
777
- bench_name,
778
751
& body. run_name ,
779
752
None ,
780
753
) ?)
0 commit comments