Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread robert engels
To clarify, I assume you have an internal request id that is tracked (if not, I am not sure how your logging would work). Create a label that matches the request ID at the top handle request layer. Then you can use pprof/trace, find that request, and do a detailed trace analysis on the event ha

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread robert engels
You can do it - just create a label for each request that you want timed individually. These will be treated as distinct events. The OS threads are shared across Go routines - so using OS thread CPU counters, or thread monitoring won’t work. So you use labels to track “events” - in this case an

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Steve Canfield
It's not that Ian's response was clearer, it's that he actually answered the question of if I can do $thing in Go; given that I can't he pointed me to the same reference as you. It's okay that Go can't do some things, but being opaque about it isn't helpful. Thanks for your help both of you! -Ste

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Robert Engels
In my first response I said to use labels and referred you to a document on how to do it. I guess Ian’s wording was clearer :) > On May 12, 2020, at 3:53 PM, Ian Lance Taylor wrote: > > On Tue, May 12, 2020 at 1:01 PM Steve Canfield > wrote: >> >> Thanks Ian. Are there limits on how many su

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Ian Lance Taylor
On Tue, May 12, 2020 at 1:01 PM Steve Canfield wrote: > > Thanks Ian. Are there limits on how many such labels exist for the life of > the process, or can be active at once? Would labeling by rpc_guid be > acceptable? There are no limits on labels other than memory usage. Ian > On Tue, May 12

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Steve Canfield
Thanks Ian. Are there limits on how many such labels exist for the life of the process, or can be active at once? Would labeling by rpc_guid be acceptable? On Tue, May 12, 2020 at 12:06 PM Ian Lance Taylor wrote: > On Tue, May 12, 2020 at 10:31 AM Steve Canfield > wrote: > > > > I feel like I m

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Ian Lance Taylor
On Tue, May 12, 2020 at 10:31 AM Steve Canfield wrote: > > I feel like I must be really dense, but it doesn't seem like you are > answering my question. > > Again, assume I have good reasons to want to know the cpu usage for every > request. Let's say I want to do isolation or billing or whateve

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-12 Thread Steve Canfield
I feel like I must be really dense, but it doesn't seem like you are answering my question. Again, assume I have good reasons to want to know the cpu usage for every request. Let's say I want to do isolation or billing or whatever on the basis of cpu usage. Is this possible in Go? -Steve On Mon

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread robert engels
Also, you may be interested in github.com/robaho/goanalyzer - I feel it makes latency analysis much easier. > On May 11, 2020, at 11:46 PM, robert engels wrote: > > You don’t need to do it this way. see https://rakyll.org/profiler-labels/ >

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread robert engels
You don’t need to do it this way. see https://rakyll.org/profiler-labels/ You label the work. The work will be recorded with the labels for analysis. The labels can be nested. This will allow you to use the execution trace to profile wall time, see https://

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread Steve Canfield
Thanks, but what about the "I can't enable profiling for every request" bit? Assume it's actually important for me to know the cpu consumption on a per request basis. On Mon, May 11, 2020 at 4:55 PM Robert Engels wrote: > Look at pprof labels. > > On May 11, 2020, at 6:29 PM, Steven Canfield >

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread Robert Engels
Look at pprof labels. > On May 11, 2020, at 6:29 PM, Steven Canfield wrote: > >  > Hi, > > I have an RPC server which has heterogenous requests, e.g. some calls hit > cache and are cheaper to serve while others need to compute a result. > > Is there any way to keep track of the cpu used jus