mirror of
https://github.com/apache/nuttx.git
synced 2026-08-08 22:17:18 +00:00
arch: Add up_perf_getfreq function
it's important to know the perf count frequency Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
8be9cb9f72
commit
ecccc614bd
5 changed files with 29 additions and 0 deletions
|
|
@ -47,6 +47,15 @@ uint32_t up_perf_gettime(void)
|
|||
return getreg32(DWT_CYCCNT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_perf_getfreq
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t up_perf_getfreq(void)
|
||||
{
|
||||
return STM32_SYSCLK_FREQUENCY;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_perf_convert
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -47,6 +47,15 @@ uint32_t up_perf_gettime(void)
|
|||
return getreg32(DWT_CYCCNT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_perf_getfreq
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t up_perf_getfreq(void)
|
||||
{
|
||||
return STM32_SYSCLK_FREQUENCY;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_perf_convert
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -388,6 +388,11 @@ uint32_t weak_function up_perf_gettime(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint32_t weak_function up_perf_getfreq(void)
|
||||
{
|
||||
return USEC_PER_SEC;
|
||||
}
|
||||
|
||||
void weak_function up_perf_convert(uint32_t elapsed, FAR struct timespec *ts)
|
||||
{
|
||||
timespec_from_usec(ts, elapsed);
|
||||
|
|
|
|||
|
|
@ -437,6 +437,11 @@ uint32_t weak_function up_perf_gettime(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint32_t weak_function up_perf_getfreq(void)
|
||||
{
|
||||
return USEC_PER_SEC;
|
||||
}
|
||||
|
||||
void weak_function up_perf_convert(uint32_t elapsed, FAR struct timespec *ts)
|
||||
{
|
||||
timespec_from_usec(ts, elapsed);
|
||||
|
|
|
|||
|
|
@ -2577,6 +2577,7 @@ void arch_sporadic_resume(FAR struct tcb_s *tcb);
|
|||
****************************************************************************/
|
||||
|
||||
uint32_t up_perf_gettime(void);
|
||||
uint32_t up_perf_getfreq(void);
|
||||
void up_perf_convert(uint32_t elapsed, FAR struct timespec *ts);
|
||||
|
||||
#undef EXTERN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue