Stap scripts to track task cpu changes
William Cohen
wcohen@redhat.com
Mon Jul 13 20:07:00 GMT 2009
Ankita Garg wrote:
> Hello William,
>
>> Subject: Re: Stap scripts to track task cpu changes
>> Date: Thursday 09 Jul 2009
>> From: William Cohen <wcohen@redhat.com>
>> To: Ankita Garg <ankita@in.ibm.com>, systemtap@sources.redhat.com,
>> prerna@linux.vnet.ibm.com
>>
>> Ankita Garg wrote:
>>> Hello folks,
>>>
>>> Quite sometime back, I was faced with a situation where I needed to
>>> track instances when a particular task was being migrated away from a
>>> cpu. I used the following trivial script. The tid needs to be passed as
>>> parameter. Sharing it, hoping it might be useful for some folks.
>> I would like to add these example to the systemtap examples. I have looked
>> through them and made some tweaks. For both of them I formatted them not to
>> use
>> tabs so they can used in documentation.
>>
>
> Thanks for making the required formatting changes.
>
>> For chng_cpu.stp use the appropriate probe point, scheduler.cpu_on. Why the
>> check for "tid() != 0"?
>>
>> For migrate.stp The check "$1 != 0" seemed to be unneeded. Was there a reason
>> for using $p->pid and kernel_string($p->comm) rather tid() and execname()?
>> The
>> test is using "tid() == $1"
>>
>
> True, the checks for tid() !=0 seem unneccesary. In migrate.stp (ie in
> function __migrate_task), the task being migrated need not be the
> current task. Hence, using $p->pid and $p->comm, where $p is the task being
> migrated.
>
>> -Will
Hi Ankita,
A bit more tweaking on the examples. For the chng_cpu2.stp I moved the
assignment to threads associative array inside the if statement to avoid
overflowing the array. For migrate3.stp I made it take the executable name, so
that it works in a manner similar to chng_cpu2.stp. Was there multiple instances
of the same execname running one the machine or would using the execname be
sufficent for migrate.stp?
-Will
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: chng_cpu2.stp
URL: <http://sourceware.org/pipermail/systemtap/attachments/20090713/5c53dd59/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: migrate3.stp
URL: <http://sourceware.org/pipermail/systemtap/attachments/20090713/5c53dd59/attachment-0001.ksh>
More information about the Systemtap
mailing list