Submitted by Anonymous on March 26, 2006 - 11:25am.
Hi,
I would like to get time marks inside my module. I see time syscall, but it returns seconds and I would like a more fine scale (like mili-seconds)
Is it possible?
Looking at a recent include/linux/time.h will show you that you can call
current_kernel_time()
or
CURRENT_TIME()
to get a timespec that goes down to nanoseconds.
I am not sure what you need this time for. If you happen to be on an x86 and you want this for profiling something (ie you don't care about wall clock time, just duration) you can use the rdtsc*() macros. They return number of ticks since the CPU was powered. You can then take a difference of two such values and convert down to meaningful time using do_div() and loops_per_jiffy.
Yes I want this to profile some functions I write in my module. I will read the functions you point me out. I think I'll use rdtsc*() macros because it is indifferent to show the time elapsed in clock ticks or nanoseconds.
Looking at a recent include/l
Looking at a recent include/linux/time.h will show you that you can call
or
to get a timespec that goes down to nanoseconds.
I am not sure what you need this time for. If you happen to be on an x86 and you want this for profiling something (ie you don't care about wall clock time, just duration) you can use the rdtsc*() macros. They return number of ticks since the CPU was powered. You can then take a difference of two such values and convert down to meaningful time using do_div() and loops_per_jiffy.
Many thanks, Yes I want th
Many thanks,
Yes I want this to profile some functions I write in my module. I will read the functions you point me out. I think I'll use rdtsc*() macros because it is indifferent to show the time elapsed in clock ticks or nanoseconds.
Many thanks!