File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -788,8 +788,29 @@ func (s *benchState) processBench(b *B) {
788
788
CodspeedTimePerRoundNs []time.Duration `json:"codspeed_time_per_round_ns"`
789
789
CodspeedItersPerRound []int64 `json:"codspeed_iters_per_round"`
790
790
}
791
+
792
+ // Build custom bench name with :: separator
793
+ var nameParts []string
794
+ current := & b .common
795
+ for current .parent != nil {
796
+ // Extract the sub-benchmark part by removing parent prefix
797
+ parentName := current .parent .name
798
+ if strings .HasPrefix (current .name , parentName + "/" ) {
799
+ subName := strings .TrimPrefix (current .name , parentName + "/" )
800
+ nameParts = append ([]string {subName }, nameParts ... )
801
+ } else {
802
+ nameParts = append ([]string {current .name }, nameParts ... )
803
+ }
804
+
805
+ if current .parent .name == "Main" {
806
+ break
807
+ }
808
+ current = current .parent
809
+ }
810
+ customBenchName := strings .Join (nameParts , "::" )
811
+
791
812
rawResults := RawResults {
792
- BenchmarkName : b . name ,
813
+ BenchmarkName : customBenchName ,
793
814
Pid : os .Getpid (),
794
815
CodspeedTimePerRoundNs : r .CodspeedTimePerRoundNs ,
795
816
CodspeedItersPerRound : r .CodspeedItersPerRound ,
You can’t perform that action at this time.
0 commit comments