Skip to content

Commit 077d550

Browse files
committed
fixup: use proper group-based uri
1 parent a60aba0 commit 077d550

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

testing/testing/benchmark.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,29 @@ func (s *benchState) processBench(b *B) {
799799
CodspeedTimePerRoundNs []time.Duration `json:"codspeed_time_per_round_ns"`
800800
CodspeedItersPerRound []int64 `json:"codspeed_iters_per_round"`
801801
}
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+
802823
rawResults := RawResults{
803-
BenchmarkName: b.name,
824+
BenchmarkName: customBenchName,
804825
Pid: os.Getpid(),
805826
CodspeedTimePerRoundNs: r.CodspeedTimePerRoundNs,
806827
CodspeedItersPerRound: r.CodspeedItersPerRound,

0 commit comments

Comments
 (0)