This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Storing lists of CPU on/off times
- From: Josh Stone <jistone at redhat dot com>
- To: systemtap at sourceware dot org
- Date: Wed, 11 Jan 2017 11:06:35 -0800
- Subject: Re: Storing lists of CPU on/off times
- Authentication-results: sourceware.org; auth=none
- References: <CAOK12DbhEzG+DTxZsQj=w9KuSKM4DdVPEyuDUbz1A7QOBhBFxw@mail.gmail.com>
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().