The caller/callee relationship in a flamegraph generated by golang pprof is wrong. Why?

I use pprof to get the CPU profile of a running golang program (cfs-server of CubeFS). And generate a flamegraph using the CPU profile:

go tool pprof http://localhost:16220/debug/pprof/profile\?seconds\=1300 # output file ~/pprof/cpu.001.pb.gz # record the profile
go tool pprof -http :11111 ~/pprof/cpu.001.pb.gz # start an interactive web page
wget -O flamegraph.htm http://localhost:11111/ui/flamegraph # download the flamegraph from the web page

Then I get the flamegraph:

You can see the middle rectangle in the second line is proto.(*UserPolicy).SetPerm. This function is:

func (policy *UserPolicy) SetPerm(volume string, perm Permission) {
	policy.mu.Lock()
	defer policy.mu.Unlock()
	policy.AuthorizedVols[volume] = []string{perm.String()}
}

// Here is the definition of Permission and perm.String
type Permission string

func (p Permission) String() string {
	return string(p)
}

(The code can be found here)

The function is quite short and it doesn’t call the functions below that rectangle in the flamegraph such as httputil.(*ReverseProxy).getErrorHandler and httputil.(*ReverseProxy).ServeHTTP.

So it seems that the caller/callee relationship of the flamegraph is wrong. Is this really wrong or am I misunderstanding something? Why this strange caller/callee relationship occur?

I searched for an explanation for this problem, but I have not found one.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.