Re: How can i track all process context switches in the kernel ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

"Manish Katiyar" <mkatiyar@xxxxxxxxx> writes:

> On Sat, May 17, 2008 at 11:55 AM, Indraneel Mukherjee
> <mukherjee.indraneel@xxxxxxxxx> wrote:
>> Hi All,
>> I'm looking for a way to track the sequence in which processes were
>> scheduled by the scheduler. Just the sequence in which processes were
>> scheduled like 23,34 45,665, 34 ....
>>  I think it can be done by inserting a printk at some appropriate
>> place in the scheduler but i'm not sure were. Can i get some pointers
>> in that direction? Is there any other easy way?
>
> How about adding something like in the function schedule() in  kernel/sched.c
>
>    printk(KERN_CRIT "Scheduling process [%u] \n",current->tgid);

On a mostly idling machine I get between 40 and 100 context switches per
second.  I doubt you want to have this printk().

Better have the scheduler push every new PID on a ring of limited size
and make the items readable in that order via /proc.

	Hannes

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux