@@ -41,8 +41,8 @@ type Request = http::Request<hyper::Body>;
41
41
type Response = http:: Response < hyper:: Body > ;
42
42
43
43
pub use crate :: api:: {
44
- self , dashboard, data, days, github, graph, info, status , CommitResponse , DateData ,
45
- ServerResult ,
44
+ self , dashboard, data, days, github, graph, info, self_profile , status , CommitResponse ,
45
+ DateData , ServerResult ,
46
46
} ;
47
47
use crate :: git;
48
48
use crate :: github:: post_comment;
@@ -605,7 +605,7 @@ fn get_self_profile_data(
605
605
bench_name : & str ,
606
606
run_name : & str ,
607
607
sort_idx : Option < i32 > ,
608
- ) -> ServerResult < collector :: SelfProfile > {
608
+ ) -> ServerResult < self_profile :: SelfProfile > {
609
609
let benchmark = commit
610
610
. benchmarks
611
611
. get ( bench_name)
@@ -628,11 +628,51 @@ fn get_self_profile_data(
628
628
} )
629
629
. ok_or ( format ! ( "No such run" ) ) ?;
630
630
631
- let mut profile = run
631
+ let profile = run
632
632
. self_profile
633
633
. as_ref ( )
634
634
. ok_or ( format ! ( "No self profile results for this commit" ) ) ?
635
635
. clone ( ) ;
636
+ let mut profile = self_profile:: SelfProfile {
637
+ totals : self_profile:: QueryData {
638
+ label : String :: from ( "Totals" ) ,
639
+ self_time : profile. query_data . iter ( ) . map ( |qd| qd. self_time ) . sum ( ) ,
640
+ number_of_cache_misses : profile
641
+ . query_data
642
+ . iter ( )
643
+ . map ( |qd| qd. number_of_cache_misses )
644
+ . sum ( ) ,
645
+ number_of_cache_hits : profile
646
+ . query_data
647
+ . iter ( )
648
+ . map ( |qd| qd. number_of_cache_hits )
649
+ . sum ( ) ,
650
+ invocation_count : profile
651
+ . query_data
652
+ . iter ( )
653
+ . map ( |qd| qd. invocation_count )
654
+ . sum ( ) ,
655
+ blocked_time : profile. query_data . iter ( ) . map ( |qd| qd. blocked_time ) . sum ( ) ,
656
+ incremental_load_time : profile
657
+ . query_data
658
+ . iter ( )
659
+ . map ( |qd| qd. incremental_load_time )
660
+ . sum ( ) ,
661
+ } ,
662
+ query_data : profile
663
+ . query_data
664
+ . into_iter ( )
665
+ . map ( |qd| self_profile:: QueryData {
666
+ label : qd. label ,
667
+ self_time : qd. self_time ,
668
+ number_of_cache_misses : qd. number_of_cache_misses ,
669
+ number_of_cache_hits : qd. number_of_cache_hits ,
670
+ invocation_count : qd. invocation_count ,
671
+ blocked_time : qd. blocked_time ,
672
+ incremental_load_time : qd. incremental_load_time ,
673
+ } )
674
+ . collect ( ) ,
675
+ } ;
636
676
637
677
if let Some ( sort_idx) = sort_idx {
638
678
loop {
@@ -668,9 +708,9 @@ fn get_self_profile_data(
668
708
}
669
709
670
710
pub async fn handle_self_profile (
671
- body : crate :: api :: self_profile:: Request ,
711
+ body : self_profile:: Request ,
672
712
data : & InputData ,
673
- ) -> ServerResult < crate :: api :: self_profile:: Response > {
713
+ ) -> ServerResult < self_profile:: Response > {
674
714
let mut it = body. benchmark . rsplitn ( 2 , '-' ) ;
675
715
let bench_ty = it. next ( ) . ok_or ( format ! ( "no benchmark type" ) ) ?;
676
716
let bench_name = it. next ( ) . ok_or ( format ! ( "no benchmark name" ) ) ?;
@@ -710,7 +750,7 @@ pub async fn handle_self_profile(
710
750
None
711
751
} ;
712
752
713
- Ok ( crate :: api :: self_profile:: Response {
753
+ Ok ( self_profile:: Response {
714
754
base_profile,
715
755
profile,
716
756
} )
0 commit comments