On 6/28/06, Fernando Apesteguía <fernando.apesteguia@xxxxxxxxx> wrote:
Hi, I would like to take some time measurements for some functions from my kernel module. In a first attempt, I tried to use current_kernel_time, but this often returns the same value before and after the call I want to measure (even, when I use the tv_nsec field.). ts1=current_kernel_time; function(); ts2=current_kernel_time; So now I'm using rdtscll instead of current_kernel_time and that's fine.. but I would like to convert that cycle units to time units. I don't know how to do it... Maybe with loops_per_jiffies and do_div but I don't know how to combine them. What is a jiffie (4 ms as wikipedia said in 2.6 kernel series) and how can I use them to convert the rdtscll return value to time units?
Hi, You can use the "jiffies" variable in the kernel to do so. Here is how you do it: unsigned long i, j; i = jiffies; function() j = jiffies; printk(" function took %ul mili secs", jiffies_to_msecs(j-i) ); Thanks, Rajat -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/