Hi all

I struggling with profiling memory allocation for a function. I start the 
test with:

go test -run ^$ -bench Scanner -memprofile mem.out -cpuprofile cpu.out -
memprofilerate=1Code hier eingeben...

and then i use pprof with:

go tool pprof log.test.exe mem.out --alloc_space
top10 log\.\(\*scanner\)
Showing nodes accounting for 0, 0% of 62.91kB total
      flat  flat%   sum%        cum   cum%



If I do the same with the cpu profile I getting results:

(pprof) top10 log\.\(\*scanner\)
Showing nodes accounting for 0.11s, 5.45% of 2.02s total
Showing top 10 nodes out of 25
      flat  flat%   sum%        cum   cum%
     0.02s  0.99%  0.99%      0.03s  1.49%  runtime.lock C:\Go\src\runtime\
lock_sema.go
     0.02s  0.99%  1.98%      0.02s  0.99%  runtime.stkbucket C:\Go\src\
runtime\mprof.go
     0.02s  0.99%  2.97%      0.02s  0.99%  runtime.unlock C:\Go\src\runtime
\lock_sema.go
     0.01s   0.5%  3.47%      0.01s   0.5%  bitbucket.org/snmed/mw/log.(*
scanner).openToken C:\Projects\goworkspace\src\bitbucket.org\snmed\mw\log\
scanner.go
     0.01s   0.5%  3.96%      0.01s   0.5%  bitbucket.org/snmed/mw/log.(*
scanner).propIDToken C:\Projects\goworkspace\src\bitbucket.org\snmed\mw\log\
scanner.go
     0.01s   0.5%  4.46%      0.03s  1.49%  bitbucket.org/snmed/mw/log.(*
scanner).textToken C:\Projects\goworkspace\src\bitbucket.org\snmed\mw\log\
scanner.go
     0.01s   0.5%  4.95%      0.01s   0.5%  runtime.mallocgc C:\Go\src\
runtime\runtime1.go
     0.01s   0.5%  5.45%      0.01s   0.5%  runtime.stdcall2 C:\Go\src\
runtime\os_windows.go
         0     0%  5.45%      0.03s  1.49%  bitbucket.org/snmed/mw/log.(*
scanner).(bitbucket.org/snmed/mw/log.alignmentToken)-fm C:\Projects\
goworkspace\src\bitbucket.org\snmed\mw\log\scanner.go
         0     0%  5.45%      0.01s   0.5%  bitbucket.org/snmed/mw/log.(*
scanner).(bitbucket.org/snmed/mw/log.openToken)-fm C:\Projects\goworkspace\
src\bitbucket.org\snmed\mw\log\scanner.go

What I'm missing here, there must be some allocations because the benchmark 
shows me allocations:

goos: windows
goarch: amd64
pkg: butbucket.org/snmed/mw/log
BenchmarkScanner-8        300000              4534 ns/op            2864 B/op 
        97 allocs/op
PASS
ok      butbucket.org/snmed/mw/log       1.618s

I'd appreciate any help.

Cheers
Sandro

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to