* Storing lists of CPU on/off times
@ 2017-01-11 17:24 Paddie O'Brien
2017-01-11 18:09 ` William Cohen
2017-01-11 19:06 ` Josh Stone
0 siblings, 2 replies; 4+ messages in thread
From: Paddie O'Brien @ 2017-01-11 17:24 UTC (permalink / raw)
To: systemtap
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?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Storing lists of CPU on/off times
2017-01-11 17:24 Storing lists of CPU on/off times Paddie O'Brien
@ 2017-01-11 18:09 ` William Cohen
2017-01-11 19:06 ` Josh Stone
1 sibling, 0 replies; 4+ messages in thread
From: William Cohen @ 2017-01-11 18:09 UTC (permalink / raw)
To: Paddie O'Brien, systemtap
On 01/11/2017 12:24 PM, 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?
>
> Thanks.
>
Hi,
The cyclethief.stp example does something like that to provide histograms of time a single process is on and off a processor. (https://sourceware.org/systemtap/examples/process/cycle_thief.txt)
You might take a look at how it is getting that information by looking at the cyclethief.stp script in /usr/share/doc/systemtap*/examples/process/cycle_thief.stp.
-Will
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Storing lists of CPU on/off times
2017-01-11 17:24 Storing lists of CPU on/off times Paddie O'Brien
2017-01-11 18:09 ` William Cohen
@ 2017-01-11 19:06 ` Josh Stone
2017-01-11 23:10 ` Paddie O'Brien
1 sibling, 1 reply; 4+ messages in thread
From: Josh Stone @ 2017-01-11 19:06 UTC (permalink / raw)
To: systemtap
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().
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Storing lists of CPU on/off times
2017-01-11 19:06 ` Josh Stone
@ 2017-01-11 23:10 ` Paddie O'Brien
0 siblings, 0 replies; 4+ messages in thread
From: Paddie O'Brien @ 2017-01-11 23:10 UTC (permalink / raw)
To: Josh Stone; +Cc: systemtap
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().
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-11 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-11 17:24 Storing lists of CPU on/off times Paddie O'Brien
2017-01-11 18:09 ` William Cohen
2017-01-11 19:06 ` Josh Stone
2017-01-11 23:10 ` Paddie O'Brien
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).