Measuring time in range of microseconds.

RKK kulkarni.ravi4 at gmail.com
Wed Dec 7 04:40:05 EST 2011


Hello Satish,


On Wed, Dec 7, 2011 at 12:41 PM, Sathishkumar Duraisamy
<bewithsathish at gmail.com> wrote:
> Hi Fredrick,
>
> On Wed, Dec 7, 2011 at 8:12 AM, Fredrick <fjohnber at 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."



More information about the Kernelnewbies mailing list