FAQ
Hi all,

First of all, I'm new to pprof and this whole thing might be because I've
simply misunderstood something basic. I've been spending a couple of hours
on this now, and am unable to get any useful data or any data resembling
what is described in the blog-post by Russ Cox: Profiling Go Programs<http://blog.golang.org/2011/06/profiling-go-programs.html>
.

1) I download this repo that I'm interested in:

go get github.com/paddie/godoku

2) It has a nice benchmark that I wanna use for
profiling: BenchmarkSolveHard (takes around 50 seconds on my machine)

?> go test -c && ./godoku.test -test.cpuprofile=tmp.prof
-test.bench=BenchmarkSolveHard
PASS
BenchmarkSolveHard 1 46624956000 ns/op

3) I run the pprof tool on the godoku.test binary and the tmp.prof:

go tool pprof godoku.test tmp.prof

4) i type top10 and I get this, which has nothing to do with what I've
written, and it is definitely not where my program spent most of its time:
(pprof) top
Total: 3831 samples
3830 100.0% 100.0% 3831 100.0% fmt.(*operator++).printReflectValue
1 0.0% 100.0% 1 0.0% reflect.valueInterface
0 0.0% 100.0% 1 0.0% fmt.(*operator++).doPrintf
0 0.0% 100.0% 439 11.5% fmt.(*operator++).printField
0 0.0% 100.0% 1 0.0% reflect.Value.Interface
0 0.0% 100.0% 1 0.0% time.Now

If anyone has any clue as to what I'm not getting, or if I've messed
anything up in the above, I'd be incredibly grateful.

--
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/groups/opt_out.

Search Discussions

  • Péter Szilágyi at Mar 5, 2013 at 3:05 pm
    Hi,

    That is strange, I just ran your commands as-is (i.e. copy paste), and:
    go get github.com/paddie/godoku
    go test -c && ./godoku.test -test.cpuprofile=tmp.prof
    -test.bench=BenchmarkSolveHard
    PASS
    BenchmarkSolveHard 1 41687690000 ns/op
    go tool pprof godoku.test tmp.prof
    Welcome to pprof! For help, type 'help'.
    (pprof) top10
    Total: 4212 samples
    2294 54.5% 54.5% 2294 54.5%
    github.com/paddie/godoku.(*Sudoku).ValidInSquare
    822 19.5% 74.0% 822 19.5%
    github.com/paddie/godoku.(*Sudoku).ValidInColumnAndRow
    441 10.5% 84.4% 3906 92.7%
    github.com/paddie/godoku.(*Sudoku).bruteforcePosition
    333 7.9% 92.4% 3461 82.2%
    github.com/paddie/godoku.(*Sudoku).ValidValueAtPosition
    76 1.8% 94.2% 76 1.8% runtime.memmove
    53 1.3% 95.4% 3925 93.2%
    github.com/paddie/godoku.(*Sudoku).nextPosition
    53 1.3% 96.7% 115 2.7% runtime.oldstack
    52 1.2% 97.9% 114 2.7% runtime.newstack
    24 0.6% 98.5% 137 3.3% runtime.lessstack
    12 0.3% 98.8% 22 0.5% runtime.stackalloc

    What Go version do you have? I have a fresh install of 1.0.3. Are you sure
    you're analyzing the correct .prof file?

    Cheers,
    Peter


    On Tue, Mar 5, 2013 at 2:32 PM, Patrick-Ranjit D. Madsen
    wrote:
    Hi all,

    First of all, I'm new to pprof and this whole thing might be because I've
    simply misunderstood something basic. I've been spending a couple of hours
    on this now, and am unable to get any useful data or any data resembling
    what is described in the blog-post by Russ Cox: Profiling Go Programs<http://blog.golang.org/2011/06/profiling-go-programs.html>
    .

    1) I download this repo that I'm interested in:

    go get github.com/paddie/godoku

    2) It has a nice benchmark that I wanna use for
    profiling: BenchmarkSolveHard (takes around 50 seconds on my machine)

    ?> go test -c && ./godoku.test -test.cpuprofile=tmp.prof
    -test.bench=BenchmarkSolveHard
    PASS
    BenchmarkSolveHard 1 46624956000 ns/op

    3) I run the pprof tool on the godoku.test binary and the tmp.prof:

    go tool pprof godoku.test tmp.prof

    4) i type top10 and I get this, which has nothing to do with what I've
    written, and it is definitely not where my program spent most of its time:
    (pprof) top
    Total: 3831 samples
    3830 100.0% 100.0% 3831 100.0% fmt.(*operator++).printReflectValue
    1 0.0% 100.0% 1 0.0% reflect.valueInterface
    0 0.0% 100.0% 1 0.0% fmt.(*operator++).doPrintf
    0 0.0% 100.0% 439 11.5% fmt.(*operator++).printField
    0 0.0% 100.0% 1 0.0% reflect.Value.Interface
    0 0.0% 100.0% 1 0.0% time.Now

    If anyone has any clue as to what I'm not getting, or if I've messed
    anything up in the above, I'd be incredibly grateful.

    --
    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/groups/opt_out.

    --
    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/groups/opt_out.
  • Michael Jones at Mar 5, 2013 at 3:20 pm
    BTW, I ran that "Paddie Hard" grid on my generic Sudoku solver...

    BenchmarkPaddie 20000 90137 ns/op

    Looks like it takes about 90 μSec to solve.
    On Tue, Mar 5, 2013 at 6:55 AM, Péter Szilágyi wrote:

    Hi,

    That is strange, I just ran your commands as-is (i.e. copy paste), and:
    go get github.com/paddie/godoku
    go test -c && ./godoku.test -test.cpuprofile=tmp.prof
    -test.bench=BenchmarkSolveHard
    PASS
    BenchmarkSolveHard 1 41687690000 ns/op
    go tool pprof godoku.test tmp.prof
    Welcome to pprof! For help, type 'help'.
    (pprof) top10
    Total: 4212 samples
    2294 54.5% 54.5% 2294 54.5%
    github.com/paddie/godoku.(*Sudoku).ValidInSquare
    822 19.5% 74.0% 822 19.5%
    github.com/paddie/godoku.(*Sudoku).ValidInColumnAndRow
    441 10.5% 84.4% 3906 92.7%
    github.com/paddie/godoku.(*Sudoku).bruteforcePosition
    333 7.9% 92.4% 3461 82.2%
    github.com/paddie/godoku.(*Sudoku).ValidValueAtPosition
    76 1.8% 94.2% 76 1.8% runtime.memmove
    53 1.3% 95.4% 3925 93.2%
    github.com/paddie/godoku.(*Sudoku).nextPosition
    53 1.3% 96.7% 115 2.7% runtime.oldstack
    52 1.2% 97.9% 114 2.7% runtime.newstack
    24 0.6% 98.5% 137 3.3% runtime.lessstack
    12 0.3% 98.8% 22 0.5% runtime.stackalloc

    What Go version do you have? I have a fresh install of 1.0.3. Are you sure
    you're analyzing the correct .prof file?

    Cheers,
    Peter


    On Tue, Mar 5, 2013 at 2:32 PM, Patrick-Ranjit D. Madsen <
    pamad05@gmail.com> wrote:
    Hi all,

    First of all, I'm new to pprof and this whole thing might be because I've
    simply misunderstood something basic. I've been spending a couple of hours
    on this now, and am unable to get any useful data or any data resembling
    what is described in the blog-post by Russ Cox: Profiling Go Programs<http://blog.golang.org/2011/06/profiling-go-programs.html>
    .

    1) I download this repo that I'm interested in:

    go get github.com/paddie/godoku

    2) It has a nice benchmark that I wanna use for
    profiling: BenchmarkSolveHard (takes around 50 seconds on my machine)

    ?> go test -c && ./godoku.test -test.cpuprofile=tmp.prof
    -test.bench=BenchmarkSolveHard
    PASS
    BenchmarkSolveHard 1 46624956000 ns/op

    3) I run the pprof tool on the godoku.test binary and the tmp.prof:

    go tool pprof godoku.test tmp.prof

    4) i type top10 and I get this, which has nothing to do with what I've
    written, and it is definitely not where my program spent most of its time:
    (pprof) top
    Total: 3831 samples
    3830 100.0% 100.0% 3831 100.0% fmt.(*operator++).printReflectValue
    1 0.0% 100.0% 1 0.0% reflect.valueInterface
    0 0.0% 100.0% 1 0.0% fmt.(*operator++).doPrintf
    0 0.0% 100.0% 439 11.5% fmt.(*operator++).printField
    0 0.0% 100.0% 1 0.0% reflect.Value.Interface
    0 0.0% 100.0% 1 0.0% time.Now

    If anyone has any clue as to what I'm not getting, or if I've messed
    anything up in the above, I'd be incredibly grateful.

    --
    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/groups/opt_out.

    --
    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/groups/opt_out.



    --
    Michael T. Jones | Chief Technology Advocate | mtj@google.com | +1
    650-335-5765

    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 5, '13 at 1:33p
activeMar 5, '13 at 3:20p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase