[go-nuts] memory profiler for benchmark test reports 0s across the board

2016-09-19 Thread Dave Cheney
Try b.ReportAllocs() before your benchmark loop. That's the easiest way to 
benchmark the allocations per operation.

-- 
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.


[go-nuts] memory profiler for benchmark test reports 0s across the board

2016-09-19 Thread 'Ethan Kennedy' via golang-nuts
I've got a function that reads `map[string]interface{}` off a channel, 
processing each one until that channel is closed. Processing each `map` 
entails allocating some slices and other data structures, grouping by like 
keys, etc.

I've got a benchmark that reads 1 rows of JSON from a file, unmarshals 
each to a `map[string]interface`, sets up channels, runs the aforementioned 
function in a Goroutine, and sends each unmarshaled JSON over the input 
channel of the function, etc., etc.

When I profile CPU usage, I get insightful output, and I've managed to 
improve performance by a factor of 4.

However, when I run the benchmark with `memprofile` flag and point pprof at 
it, I get something like:

0 of 0 total ( 0%)
 flat flat% sum%  cum cum%
00%  0%  0  0% pkgname.SomeFunc
00%  0%  0  0% pkgname.SomeOtherFunc

I'm running Go 1.6 on Ubuntu 12.04.

I've searched and searched but not found any answers as to why I am unable 
to obtain a good heap profile. `runtime.mallocgc` features prominently in 
my cpu profiles, so I know objects are getting allocated and collected.

Any help?

Thanks

-- 
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.