FAQ
I've added a handler in my webserver that passes on the request to
the net/http/pprof package as follows:

     httpprof.Handler("block").ServeHTTP(res,req)

but if I call that endpoint via:

     go tool pprof bin/my_binary http://localhost/_debug/pprof/block

I get this error:

     Fetching profile from http://localhost:4985/_debug/pprof/block
     parsing profile: unrecognized profile format

If I try using curl instead of the go tool pprof command, I see this
returned:

     --- contention:
     cycles/second=2395538828

Am I doing something wrong or is this known not to work on Go 1.4? In the
Go blog post about profiling go programs
<http://blog.golang.org/profiling-go-programs> it says "The goroutine
blocking profile will be explained in a future post. Stay tuned." but it
looks like that post is still in the works.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Yves Junqueira at Feb 24, 2015 at 12:31 am
    The profile output is empty because the blocking profile is disabled by
    default. You have to set a profiling rate using the runtime package.

    http://golang.org/pkg/runtime/#SetBlockProfileRate

    Typically you would set it to something like 1%, then leave it on for
    enough time to collect interesting samples for your application, then
    disable it again. After that the blocking profile fetched via HTTP will
    have data.

    The exact rate and period of collection you should use is application
    dependent - it's a balance between instrumentation precision and execution
    overhead. Experimentation is the best way to find what works best for you
    (ie: collect more blocking samples as fast as possible but without hurting
    your system performance too much).

    The more interest part is how to interpret the data, and tell when a
    blocking time is benign (e.g: waiting for IO) or not (e.g: excessive
    locking).
    On Feb 23, 2015 11:58 PM, "Traun Leyden" wrote:


    I've added a handler in my webserver that passes on the request to
    the net/http/pprof package as follows:

    httpprof.Handler("block").ServeHTTP(res,req)

    but if I call that endpoint via:

    go tool pprof bin/my_binary http://localhost/_debug/pprof/block

    I get this error:

    Fetching profile from http://localhost:4985/_debug/pprof/block
    parsing profile: unrecognized profile format

    If I try using curl instead of the go tool pprof command, I see this
    returned:

    --- contention:
    cycles/second=2395538828

    Am I doing something wrong or is this known not to work on Go 1.4? In the
    Go blog post about profiling go programs
    <http://blog.golang.org/profiling-go-programs> it says "The goroutine
    blocking profile will be explained in a future post. Stay tuned." but it
    looks like that post is still in the works.


    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Traun Leyden at Feb 24, 2015 at 12:41 am
    Thank you! I think that was the missing link. I will give that a shot.
    On Monday, February 23, 2015 at 4:32:47 PM UTC-8, Yves Junqueira wrote:

    The profile output is empty because the blocking profile is disabled by
    default. You have to set a profiling rate using the runtime package.

    http://golang.org/pkg/runtime/#SetBlockProfileRate

    Typically you would set it to something like 1%, then leave it on for
    enough time to collect interesting samples for your application, then
    disable it again. After that the blocking profile fetched via HTTP will
    have data.

    The exact rate and period of collection you should use is application
    dependent - it's a balance between instrumentation precision and execution
    overhead. Experimentation is the best way to find what works best for you
    (ie: collect more blocking samples as fast as possible but without hurting
    your system performance too much).

    The more interest part is how to interpret the data, and tell when a
    blocking time is benign (e.g: waiting for IO) or not (e.g: excessive
    locking).
    On Feb 23, 2015 11:58 PM, "Traun Leyden" <traun....@gmail.com
    <javascript:>> wrote:
    I've added a handler in my webserver that passes on the request to
    the net/http/pprof package as follows:

    httpprof.Handler("block").ServeHTTP(res,req)

    but if I call that endpoint via:

    go tool pprof bin/my_binary http://localhost/_debug/pprof/block

    I get this error:

    Fetching profile from http://localhost:4985/_debug/pprof/block
    parsing profile: unrecognized profile format

    If I try using curl instead of the go tool pprof command, I see this
    returned:

    --- contention:
    cycles/second=2395538828

    Am I doing something wrong or is this known not to work on Go 1.4? In
    the Go blog post about profiling go programs
    <http://blog.golang.org/profiling-go-programs> it says "The goroutine
    blocking profile will be explained in a future post. Stay tuned." but it
    looks like that post is still in the works.


    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Ps at Feb 24, 2015 at 2:30 am
    You may not need it now, but it appears the 'profile' package handles that
    for you (with a default rate setting):

    https://github.com/davecheney/profile

    On Monday, February 23, 2015 at 7:40:59 PM UTC-5, Traun Leyden wrote:


    Thank you! I think that was the missing link. I will give that a shot.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 23, '15 at 10:57p
activeFeb 24, '15 at 2:30a
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase