I remember doing this some ~15 years ago, simply by emitting RDTSC instructions into my C code (RDTSC == Read Time Stamp Counter). This was done with Watcom C under DOS though.
http://en.wikipedia.org/wiki/Time_Stamp_Counter On Wed, Jul 25, 2012 at 10:09 AM, Nadav Har'El <n...@math.technion.ac.il>wrote: > Hi, as you know the time(1) command, and the times(2) system call is > able to separate a process's running time into "user" and "system" time, > measuring the CPU time in user space and kernel space respectively. > > However, these only have a jiffy (often 1/250 seconds) resultion. > > I'm now trying to measure a process running around 3 milliseconds, less > than one jiffy, and I still want to understand how much of it is spent in > user space, and how much of it is spent in kernel space (e.g., handling on > minor page faults caused by this process). Does anybody have any idea what > I > can use to do that, preferably without modifying the Linux kernel? > > Before anyone asks, no - I cannot cause this 3 milliseconds to take 3 > seconds by looping 1000 times, because this will completely change the > behavior (e.g., page faults) caused by the process. Also, I have full > control of the machine, so any mechanism which measures CPU usage in the > whole machine instead of just one specific process would also be fine. > > Any ideas would be valued. > > Nadav. > > -- > Nadav Har'El | Wednesday, Jul 25 2012, 6 Av > 5772 > n...@math.technion.ac.il > |----------------------------------------- > Phone +972-523-790466, ICQ 13349191 |I am not a complete idiot - some > parts > http://nadav.harel.org.il |are missing. > > _______________________________________________ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il >
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il