This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Storing lists of CPU on/off times


On 01/11/2017 09:24 AM, Paddie O'Brien wrote:
> Hi,
> 
> I want to store a per process list of CPU on/off times. So in probe
> scheduler.cpu_on I had hoped to do something like:
> 
> timestamps[execname()][count] = gettimeofday_us()
> count++
> 
> This above is illegal but illustrates what I'm trying to do. Can it be done?

You can't nest the data structure like that, but you *can* use multiple
indexes, like:

    timestamps[execname(), count] = gettimeofday_us()

I'd be wary of execname() for this though, since there could be multiple
processes with the same name.  I suppose that depends on what you need
to do with this data, but pid() is probably a better choice.

Further, you may want to track the scheduling of threads in particular,
since that's the actual unit which is scheduled on/off of CPUs, so then
you'd index by tid().


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]