[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to measure time spent in Context switch
On Thu, May 7, 2009 at 11:33 AM, Devesh Sharma <devesh28@xxxxxxxxx> wrote:
> Hello list,
> I want to measure the exact time spent by some process in doing single
> Context switch. How can I measure it?
>
The standard tool for that is lmbench, available from the "free
software" section on http://www.bitmover.com/ .
or One I found when I googled.
Sure, you can try something like my clockwatcher.c :
#include <stdio.h>
#include <asm/msr.h>
#include <linux/config.h>
main () {
unsigned long i, c, t ;
for (i = 0; i < 1000; i++ ) {
c = t = 0 ;
rdtscl(t);
do {
c = t ;
rdtscl(t);
} while ((t-c) < 90) ;
printf(" %u\n",(t-c+32)&-64);
}
}
Or even this might be helpful to you.
http://lkml.indiana.edu/hypermail/linux/kernel/9804.2/1142.html
> -Devesh
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
--
Regards,
Sandeep.
“To learn is to change. Education is a process that changes the learner.”
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ