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