Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/pprof: make runtime.reflectcall followable by pprof #11786

Open
thwd opened this issue Jul 19, 2015 · 4 comments

Comments

@thwd
Copy link

commented Jul 19, 2015

Context: http://stackoverflow.com/q/31419307/532430

Proposal: allow pprof to follow reflective function invocations via runtime.reflectcall so that code "after the jump" can be profiled.

I think the idea is simple enough but if anything was unclear just ask and I'll try to clarify.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 20, 2015

To be honest, I'm not sure this has to be a proposal. I think the current behaviour is a bug. I don't know what is involved in fixing it, but I can't imagine that anybody would object to a good fix.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 20, 2015

@mikioh mikioh added the Proposal label Aug 13, 2015

@adg adg changed the title proposal: make runtime.reflectcall followable by pprof runtime: make runtime.reflectcall followable by pprof Aug 24, 2015

@adg adg removed the Proposal label Aug 24, 2015

@adg

This comment has been minimized.

Copy link
Contributor

commented Aug 24, 2015

Agree, this needn't be a proposal.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 5, 2015

This is a bug in pprof alone. The full information is in the profile, but the elision of runtime frames is getting confused by the reflect call and eliding everything below it. You can see the extra information using -runtime.

$ cat x_test.go
package x

import (
    "reflect"
    "testing"
)

func TestReflect(t *testing.T) {
    v := reflect.ValueOf(f)
    for i := 0; i < 10000; i++ {
        v.Call(nil)
    }
}

var x [][]byte

func f() {
    x = append(x, make([]byte, 10000))
}
$ go test -memprofile=x.prof x_test.go
ok      command-line-arguments  0.093s
$ go tool pprof -top x.test x.prof
100.50MB of 100.50MB total (  100%)
      flat  flat%   sum%        cum   cum%
  100.50MB   100%   100%   100.50MB   100%  reflect.Value.call
         0     0%   100%   100.50MB   100%  command-line-arguments.TestReflect
         0     0%   100%   100.50MB   100%  reflect.Value.Call
         0     0%   100%   100.50MB   100%  runtime.goexit
         0     0%   100%   100.50MB   100%  testing.tRunner
$ go tool pprof -top -runtime x.test x.prof
100.50MB of 100.50MB total (  100%)
Dropped 1 node (cum <= 0.50MB)
      flat  flat%   sum%        cum   cum%
  100.50MB   100%   100%   100.50MB   100%  runtime.makeslice
         0     0%   100%   100.50MB   100%  command-line-arguments.TestReflect
         0     0%   100%   100.50MB   100%  command-line-arguments.f
         0     0%   100%   100.50MB   100%  reflect.Value.Call
         0     0%   100%   100.50MB   100%  reflect.Value.call
         0     0%   100%   100.50MB   100%  runtime.call32
         0     0%   100%   100.50MB   100%  runtime.goexit
         0     0%   100%   100.50MB   100%  testing.tRunner
$

@rsc rsc changed the title runtime: make runtime.reflectcall followable by pprof cmd/pprof: make runtime.reflectcall followable by pprof Nov 5, 2015

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2015

We ran out of time for this in Go 1.6.

@rsc rsc modified the milestones: Unplanned, Go1.6 Dec 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.