@@ -333,6 +333,23 @@ func inlinedCalleeDump(pcs []uintptr) {
333
333
dumpCallers (pcs )
334
334
}
335
335
336
+ type inlineWrapperInterface interface {
337
+ dump (stack []uintptr )
338
+ }
339
+
340
+ type inlineWrapper struct {
341
+ }
342
+
343
+ func (h inlineWrapper ) dump (pcs []uintptr ) {
344
+ dumpCallers (pcs )
345
+ }
346
+
347
+ func inlinedWrapperCallerDump (pcs []uintptr ) {
348
+ var h inlineWrapperInterface
349
+ h = & inlineWrapper {}
350
+ h .dump (pcs )
351
+ }
352
+
336
353
func TestCPUProfileRecursion (t * testing.T ) {
337
354
matches := matchAndAvoidStacks (stackContains , []string {"runtime/pprof.inlinedCallee" , "runtime/pprof.recursionCallee" , "runtime/pprof.recursionCaller" }, avoidFunctions ())
338
355
p := testCPUProfile (t , matches , func (dur time.Duration ) {
@@ -2054,6 +2071,8 @@ func TestTryAdd(t *testing.T) {
2054
2071
for i := range pcs {
2055
2072
inlinedCallerStack [i ] = uint64 (pcs [i ])
2056
2073
}
2074
+ wrapperPCs := make ([]uintptr , 1 )
2075
+ inlinedWrapperCallerDump (wrapperPCs )
2057
2076
2058
2077
if _ , found := findInlinedCall (recursionChainBottom , 4 << 10 ); ! found {
2059
2078
t .Skip ("Can't determine whether anything was inlined into recursionChainBottom." )
@@ -2226,6 +2245,17 @@ func TestTryAdd(t *testing.T) {
2226
2245
{Value : []int64 {70 , 70 * period }, Location : []* profile.Location {{ID : 1 }}},
2227
2246
{Value : []int64 {80 , 80 * period }, Location : []* profile.Location {{ID : 2 }, {ID : 1 }}},
2228
2247
},
2248
+ }, {
2249
+ name : "expand_wrapper_function" ,
2250
+ input : []uint64 {
2251
+ 3 , 0 , 500 , // hz = 500. Must match the period.
2252
+ 4 , 0 , 50 , uint64 (wrapperPCs [0 ]),
2253
+ },
2254
+ count : 2 ,
2255
+ wantLocs : [][]string {{"runtime/pprof.inlineWrapper.dump" }},
2256
+ wantSamples : []* profile.Sample {
2257
+ {Value : []int64 {50 , 50 * period }, Location : []* profile.Location {{ID : 1 }}},
2258
+ },
2229
2259
}}
2230
2260
2231
2261
for _ , tc := range testCases {
0 commit comments