dumpCallers(pcs)
}
+type inlineWrapperInterface interface {
+ dump(stack []uintptr)
+}
+
+type inlineWrapper struct {
+}
+
+func (h inlineWrapper) dump(pcs []uintptr) {
+ dumpCallers(pcs)
+}
+
+func inlinedWrapperCallerDump(pcs []uintptr) {
+ var h inlineWrapperInterface
+ h = &inlineWrapper{}
+ h.dump(pcs)
+}
+
func TestCPUProfileRecursion(t *testing.T) {
matches := matchAndAvoidStacks(stackContains, []string{"runtime/pprof.inlinedCallee", "runtime/pprof.recursionCallee", "runtime/pprof.recursionCaller"}, avoidFunctions())
p := testCPUProfile(t, matches, func(dur time.Duration) {
for i := range pcs {
inlinedCallerStack[i] = uint64(pcs[i])
}
+ wrapperPCs := make([]uintptr, 1)
+ inlinedWrapperCallerDump(wrapperPCs)
if _, found := findInlinedCall(recursionChainBottom, 4<<10); !found {
t.Skip("Can't determine whether anything was inlined into recursionChainBottom.")
{Value: []int64{70, 70 * period}, Location: []*profile.Location{{ID: 1}}},
{Value: []int64{80, 80 * period}, Location: []*profile.Location{{ID: 2}, {ID: 1}}},
},
+ }, {
+ name: "expand_wrapper_function",
+ input: []uint64{
+ 3, 0, 500, // hz = 500. Must match the period.
+ 4, 0, 50, uint64(wrapperPCs[0]),
+ },
+ count: 2,
+ wantLocs: [][]string{{"runtime/pprof.inlineWrapper.dump"}},
+ wantSamples: []*profile.Sample{
+ {Value: []int64{50, 50 * period}, Location: []*profile.Location{{ID: 1}}},
+ },
}}
for _, tc := range testCases {