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: "Paddie O'Brien" <paddieobrien at gmail dot com>
- To: Josh Stone <jistone at redhat dot com>
- Cc: systemtap <systemtap at sourceware dot org>
- Date: Wed, 11 Jan 2017 23:10:20 +0000
- Subject: Re: Storing lists of CPU on/off times
- Authentication-results: sourceware.org; auth=none
- References: <CAOK12DbhEzG+DTxZsQj=w9KuSKM4DdVPEyuDUbz1A7QOBhBFxw@mail.gmail.com> <42f6b30f-ba6f-6988-f546-01d399918634@redhat.com>
With some post processing I can make timestamps[execname(), count] do
what I need.
Switched to threads as recommended. I can now see that a switch like
vlc ---> vlc was actually a switch between two threads in same
process.
Had a look at cycle_thief.stp but it appears to use an associative
array to map to aggregates which wasn't really what I wanted since it
threw away the individual timestamps.
Thank you.
On 11 January 2017 at 19:06, Josh Stone <jistone@redhat.com> wrote:
> 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().