The 17% is sleeping. The 70% is garbage collection.

On Wednesday, January 12, 2022 at 3:54:32 PM UTC-6 st...@rothskeller.net 
wrote:

> I am attempting to profile my code, and I'm unable to interpret the 
> results.  So first, the meta-question is, what's the best forum to use to 
> request help with such things?
>
> The code I'm profiling is the server side of a moderately complex webapp.  
> For simplicity, I've wrapped it with net/http/cgi and am calling it from 
> the command line as a CGI "script".  As such, it is handling a single 
> request with no actual network traffic.  Also, I've disabled the garbage 
> collector.  I'm calling pprof.StartCPUProfile at the top of ServeHTTP.  The 
> pprof output is at
>
> https://scholacantorum.org/pprof.svg
>
> It shows three different call chains.  The one that actually includes my 
> code, starting at runtime.main, is only 6% of the total CPU samples.  There 
> are two other call chains that are entirely within the runtime package, one 
> of them taking 17% of the time and the other taking a whopping 70% of the 
> time, and I can't figure out what they're doing.  I would appreciate any 
> guidance.
>
> The chain that is taking 70% of the time is
>
> gcBgMarkWorker
>
> systemstack
>
> gcBgMarkWorker.func2
>
> gcDrain
>
> markroot
>
> markroot.func1
>
> suspendG
>
> Underneath suspendG it splits into nanotime, osyield, procyield, and 
> preemptM, the latter of which has signalM, tgkill, and getpid children.  
> getpid alone is shown as taking 4% of the CPU of the entire program!  What 
> the heck is this call chain doing, with nearly three quarters of my time?
>
> The chain that is taking 17% of the time is
>
> mcall
>
> park_m
>
> schedule
>
> findrunnable
>
> stopm
>
> mPark
>
> notesleep
>
> futexsleep
>
> futex
>
> Again I have no clue what this is doing.  Any guidance is welcome, 
> including pointers to other forums better suited for such questions.
>
> Regards,
> Steve
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1e1ce42b-fea3-4247-9d20-558caed4093bn%40googlegroups.com.

Reply via email to