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 @@ -799,8 +799,29 @@ func (s *benchState) processBench(b *B) {
799
799
CodspeedTimePerRoundNs []time.Duration `json:"codspeed_time_per_round_ns"`
800
800
CodspeedItersPerRound []int64 `json:"codspeed_iters_per_round"`
801
801
}
802
+
803
+ // Build custom bench name with :: separator
804
+ var nameParts []string
805
+ current := & b .common
806
+ for current .parent != nil {
807
+ // Extract the sub-benchmark part by removing parent prefix
808
+ parentName := current .parent .name
809
+ if strings .HasPrefix (current .name , parentName + "/" ) {
810
+ subName := strings .TrimPrefix (current .name , parentName + "/" )
811
+ nameParts = append ([]string {subName }, nameParts ... )
812
+ } else {
813
+ nameParts = append ([]string {current .name }, nameParts ... )
814
+ }
815
+
816
+ if current .parent .name == "Main" {
817
+ break
818
+ }
819
+ current = current .parent
820
+ }
821
+ customBenchName := strings .Join (nameParts , "::" )
822
+
802
823
rawResults := RawResults {
803
- BenchmarkName : b . name ,
824
+ BenchmarkName : customBenchName ,
804
825
Pid : os .Getpid (),
805
826
CodspeedTimePerRoundNs : r .CodspeedTimePerRoundNs ,
806
827
CodspeedItersPerRound : r .CodspeedItersPerRound ,
You can’t perform that action at this time.
0 commit comments