Measuring time in range of microseconds.
Hi, I am writing a module to measure time taken between two events. I have to measure time in microseconds. Some articles says about High resolution timers. As per the article http://elinux.org/High_Resolution_Timers, I read cat /proc/timer_list which says 10000000ns as resolution ( which is 10ms). I think with this resolution I cannot measure in the range of microseconds. I couldn't able to find support for HR timer in kernel menuconfig. I am using kernel 2.6.36.2. Can you please help me to, "How do enable this timer. Or is there any other means to measure time or simply I have to use the timer hardware directly?" -- With Thanks, Sathishkumar D http://flowersopenlab.weebly.com/
Hi Sathishkumar, I've used RDTSC instruction as precision timer. RDTSC measures clock cycles. Example on: petersenna.com/files/rdtscbench-1.0.tar.gz More about rdtsc: http://en.wikipedia.org/wiki/Time_Stamp_Counter http://people.virginia.edu/~chg5w/page3/assets/MeasuringUnix.pdf Regards, Peter On Tue, Dec 6, 2011 at 6:47 AM, Sathishkumar Duraisamy <bewithsathish@gmail.com> wrote:
Hi,
I am writing a module to measure time taken between two events. I have to measure time in microseconds. Some articles says about High resolution timers. As per the article http://elinux.org/High_Resolution_Timers, I read cat /proc/timer_list which says 10000000ns as resolution ( which is 10ms). I think with this resolution I cannot measure in the range of microseconds. I couldn't able to find support for HR timer in kernel menuconfig.
I am using kernel 2.6.36.2. Can you please help me to, "How do enable this timer. Or is there any other means to measure time or simply I have to use the timer hardware directly?"
-- With Thanks, Sathishkumar D http://flowersopenlab.weebly.com/
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Peter Senna Tschudin peter.senna@gmail.com gpg id: 48274C36
Hi Peter, Thanks for rdtsc. But I looking to measure time inside Linux Kernel Module in ARM architecture. -- Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hi Sathishkumar, rdtsc is x86 specific... Sorry. But there are other options. Compares rdtsc with hpet: http://aufather.wordpress.com/2010/09/08/high-performance-time-measuremen-in... Other reference about timers: http://the-b.org/Linux_timers I'm not sure if HPET works on ARM. []'s Peter On Tue, Dec 6, 2011 at 9:06 AM, Sathishkumar Duraisamy <bewithsathish@gmail.com> wrote:
Hi Peter,
Thanks for rdtsc. But I looking to measure time inside Linux Kernel Module in ARM architecture.
-- Regards, Sathishkumar D http://flowersopenlab.weebly.com/
-- Peter Senna Tschudin peter.senna@gmail.com gpg id: 48274C36
I think if the specific ARM platform you are working supports a oneshot clock_device, you would get the high res timer support. You can check for clock_devices defined in your platform having feature - CLOCK_EVT_FEAT_ONESHOT. -Fredrick On 12/06/2011 03:17 AM, Peter Senna Tschudin wrote:
Hi Sathishkumar,
rdtsc is x86 specific... Sorry.
But there are other options.
Compares rdtsc with hpet: http://aufather.wordpress.com/2010/09/08/high-performance-time-measuremen-in...
Other reference about timers: http://the-b.org/Linux_timers
I'm not sure if HPET works on ARM.
[]'s
Peter
On Tue, Dec 6, 2011 at 9:06 AM, Sathishkumar Duraisamy <bewithsathish@gmail.com> wrote:
Hi Peter,
Thanks for rdtsc. But I looking to measure time inside Linux Kernel Module in ARM architecture.
-- Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hi Fredrick, On Wed, Dec 7, 2011 at 8:12 AM, Fredrick <fjohnber@zoho.com> wrote:
I think if the specific ARM platform you are working supports a oneshot clock_device, you would get the high res timer support.
You can check for clock_devices defined in your platform having feature - CLOCK_EVT_FEAT_ONESHOT.
I have been working on s3c6410 SOC. As per kconfig file, currently for 2.6.36, my platform doesn't support these dependencies. I have to check with recent kernels. "config HIGH_RES_TIMERS bool "High Resolution Timer Support" depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS select TICK_ONESHOT help This option enables high resolution timer support. If your hardware is not capable then this option only increases the size of the kernel image." -- Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hello Satish, On Wed, Dec 7, 2011 at 12:41 PM, Sathishkumar Duraisamy <bewithsathish@gmail.com> wrote:
Hi Fredrick,
On Wed, Dec 7, 2011 at 8:12 AM, Fredrick <fjohnber@zoho.com> wrote:
I think if the specific ARM platform you are working supports a oneshot clock_device, you would get the high res timer support.
You can check for clock_devices defined in your platform having feature - CLOCK_EVT_FEAT_ONESHOT.
My guess is that u want to measure the time taken to execute a function in microseconds. something like start_time YOUR_FUNCTION end_time for this i use something like this declare struct timeval tv in your function and insert printk statements before and after calling to your function do_gettimeofday(&tv); printk ("Before %s (): Sec = %d micro Sec = %d\n", __FUNCTION__, tv.tv_sec, tv.tv_usec); call_to_your_function((); printk ("After %s (): Sec = %d micro Sec = %d\n", __FUNCTION__, tv.tv_sec, tv.tv_usec); -- Warm Regards, Ravi . "I don't Know is not a excuse , its an opportunity."
Hi On Wed, Dec 7, 2011 at 3:10 PM, RKK <kulkarni.ravi4@gmail.com> wrote:
Hello Satish,
On Wed, Dec 7, 2011 at 12:41 PM, Sathishkumar Duraisamy <bewithsathish@gmail.com> wrote:
Hi Fredrick,
On Wed, Dec 7, 2011 at 8:12 AM, Fredrick <fjohnber@zoho.com> wrote:
I think if the specific ARM platform you are working supports a oneshot clock_device, you would get the high res timer support.
You can check for clock_devices defined in your platform having feature - CLOCK_EVT_FEAT_ONESHOT.
My guess is that u want to measure the time taken to execute a function in microseconds. something like start_time YOUR_FUNCTION end_time
Sorry. I want to measure external pulse on a GPIO pin. -- Regards, Sathishkumar D http://flowersopenlab.weebly.com/
participants (4)
-
Fredrick -
Peter Senna Tschudin -
RKK -
Sathishkumar Duraisamy