Forums - Need a high resolution timer

3 posts / 0 new
Last post
Need a high resolution timer
dinesh.goel
Join Date: 2 Feb 19
Location: Gurgaon
Posts: 2
Posted: Sat, 2019-02-02 19:45

Do we have support for a high resolution timer in the device? If so where i can get its documentation from. I want to do performance analysis on the code.

regards,

dinesh

  • Up0
  • Down0
jaydenk
Join Date: 21 Jun 18
Posts: 64
Posted: Wed, 2019-02-06 15:11

Hi Dinesh,

We support high resolution timer via Advanced Timer Service (ATS). Application is able to set high-resolution timers. Currently the hardware timer that supports ATS runs at 32000Hz.

Please refer qapi_timer.h.

Thanks
BR,
Jayden

  • Up0
  • Down0
dinesh.goel
Join Date: 2 Feb 19
Location: Gurgaon
Posts: 2
Posted: Fri, 2019-03-01 23:13

Hello, 

As suggested i tried the advanced timer services. I think that the timer is not starting.For different operations the time as measured by qRT changes but the Time difference as shown by the QAPI Timer APIs does not change. I am expected the timer to start when qapi_Timer_Set API is called. 

Below is the sequence i am using in my code.

A. Call qapi_Timer_Def()

qapi_TIMER_handle_t timer_hdl = (qapi_TIMER_handle_t)NULL;
qapi_Status_t status;
qapi_TIMER_define_attr_t timer_def_aatrib = 
{
false, QAPI_TIMER_NO_NOTIFY_TYPE, (void*)NULL, 0
};
status = qapi_Timer_Def(&timer_hdl, &timer_def_aatrib);
 
B. Call qapi_Timer_Set() --> expecting timer of 1hr with a unit of millisec shall start when the call to qapi_Timer_set is made. (Tried with QAPI_TIMER_UNIT_USEC as well but not success)
 
qapi_TIMER_set_attr_t timer_set_attrib = 
{
(uint64_t)60*60*1000, false, 0, QAPI_TIMER_UNIT_MSEC
};
qapi_Timer_Set(timer_hdl, &timer_set_attrib);
 
C. Call qapi_Timer_Stop -->Stop the timer after the operation is complete
qapi_Timer_Stop(timer_hdl);
 
D. Read the Time elapsed (qapi_Timer_Get_Time_Info()):
uint64_t time_expired, total_time;
qapi_Timer_Get_Time_Info(timer_hdl, QAPI_TIMER_TIMER_INFO_TIMER_DURATION, &total_time);
qapi_Timer_Get_Time_Info(timer_hdl, QAPI_TIMER_TIMER_INFO_TIMER_REMAINING, &time_expired);
return (total_time - time_expired);
 
 
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.