FAQ
Thank you for your explanation, Dave.
I have just installed exactly the same Linux environment on the same
machine, but as dual boot.
The result is now normal :

nico@nico-dv7 ~/z_go/src/inut15 $ go tool pprof -text ./inut15 myprof.prof
Total: 762 samples
      334 43.8% 43.8% 537 70.5% runtime.mallocgc
      132 17.3% 61.2% 138 18.1% runtime.MSpan_Sweep
      103 13.5% 74.7% 640 84.0% runtime.new
       50 6.6% 81.2% 690 90.6% main.main
       44 5.8% 87.0% 44 5.8% scanblock
       42 5.5% 92.5% 42 5.5% runtime.markspan
        8 1.0% 93.6% 8 1.0% runtime.usleep
        6 0.8% 94.4% 6 0.8% runtime.futex
        5 0.7% 95.0% 86 11.3% MCentral_Grow
        5 0.7% 95.7% 5 0.7% flushptrbuf
        3 0.4% 96.1% 3 0.4% ExternalCode
        3 0.4% 96.5% 35 4.6% MHeap_AllocLocked

So, the conclusion is that profiling cannot be done inside a Virtual
Machine.


Le mercredi 1 octobre 2014 00:32:24 UTC+2, Dave Cheney a écrit :
I don't believe that you can profile reliably inside a VM. Profiling
requires the profiling signal to be delivered to the program at
precise intervals, and precision and time is not something VMs do
well.

On Wed, Oct 1, 2014 at 3:28 AM, <nicolas...@gmail.com <javascript:>>
wrote:
I run my program in Linux inside VirtualBox, installed on Windows 7.

Linux nico-Qiana-Xfce 3.13.0-24-generic #47-Ubuntu SMP Fri May 2
23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

go version go1.3.1 linux/amd64


I have made this small program:

http://play.golang.org/p/gtQJ8et_1w

When I run it, I find "ExternalCode" at top of pprof listing.

nico@nico-Qiana-Xfce ~/z_go/src/inut/inut15 $ time ./inut15
-cpuprofile=myprof.prof
i=100000000, r=100000000, a=100000000

real 0m22.885s
user 0m13.213s
sys 0m9.412s

nico@nico-Qiana-Xfce ~/z_go/src/inut/inut15 $ go tool pprof -text ./inut15
myprof.prof
Total: 2197 samples
1617 73.6% 73.6% 1617 73.6% ExternalCode
425 19.3% 92.9% 425 19.3% runtime.usleep
50 2.3% 95.2% 93 4.2% runtime.mallocgc
26 1.2% 96.4% 26 1.2% runtime.MSpan_Sweep
24 1.1% 97.5% 24 1.1% runtime.futex
17 0.8% 98.3% 110 5.0% runtime.new
12 0.5% 98.8% 12 0.5% scanblock
8 0.4% 99.2% 118 5.4% main.main
3 0.1% 99.3% 3 0.1% runtime.memclr
2 0.1% 99.4% 2 0.1% flushptrbuf
2 0.1% 99.5% 3 0.1% runtime.gentraceback
1 0.0% 99.5% 15 0.7% MCentral_Grow
1 0.0% 99.6% 1 0.0% flushallmcaches
1 0.0% 99.6% 1 0.0% gc
1 0.0% 99.7% 1 0.0% markonly
1 0.0% 99.7% 1 0.0% runtime.MCentral_UncacheSpan
1 0.0% 99.8% 1 0.0% runtime.MHeap_LookupMaybe
1 0.0% 99.8% 1 0.0% runtime.cas
1 0.0% 99.9% 1 0.0% runtime.findfunc
1 0.0% 99.9% 1 0.0% runtime.funcspdelta
1 0.0% 100.0% 1 0.0% runtime.markspan
1 0.0% 100.0% 1 0.0% scanframe
0 0.0% 100.0% 78 3.6% GC
0 0.0% 100.0% 11 0.5% MHeap_AllocLocked
0 0.0% 100.0% 11 0.5% MHeap_Reclaim
0 0.0% 100.0% 2001 91.1% System
0 0.0% 100.0% 1 0.0% profilealloc
0 0.0% 100.0% 32 1.5% runtime.MCache_Refill
0 0.0% 100.0% 31 1.4% runtime.MCentral_CacheSpan
0 0.0% 100.0% 13 0.6% runtime.MHeap_Alloc
0 0.0% 100.0% 1 0.0% runtime.MProf_Malloc
0 0.0% 100.0% 1 0.0% runtime.callers
0 0.0% 100.0% 10 0.5% runtime.futexwakeup
0 0.0% 100.0% 10 0.5% runtime.gc
0 0.0% 100.0% 118 5.4% runtime.gosched0
0 0.0% 100.0% 118 5.4% runtime.main
0 0.0% 100.0% 10 0.5% runtime.notewakeup
0 0.0% 100.0% 10 0.5% runtime.starttheworld
0 0.0% 100.0% 11 0.5% runtime.sweepone

There is no cgo code. But as the loop is creating a lot of objects, it may
be that this "ExternalCode" is the garbage collector ?

Can someone run this code and tell me if he sees the same pprof output ?




--
You received this message because you are subscribed to a topic in the
Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/golang-nuts/5lxfW3cninU/unsubscribe.
To unsubscribe from this group and all its topics, 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.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 8 of 8 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 30, '14 at 12:57a
activeSep 30, '14 at 11:25p
posts8
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase