mirror of
https://github.com/t-crest/rtems.git
synced 2025-12-16 04:19:07 +00:00
Implemented benchmark timer (for the testsuite).
This commit is contained in:
@@ -90,8 +90,13 @@ extern char _uart_base; /* linker symbol giving the address of the UART */
|
||||
|
||||
extern char _timer_base; /* linker symbol giving the address of the RTC */
|
||||
|
||||
extern void set_cpu_cycles (u64 time_warp);
|
||||
extern u64 get_cpu_cycles(void);
|
||||
extern u64 get_cpu_time(void);
|
||||
|
||||
#define PATMOS_FREQ_MHZ 74
|
||||
#define PATMOS_FREQ_HZ ( PATMOS_FREQ_MHZ * 1000000U)
|
||||
#define PATMOS_INF 0xFFFFFFFF
|
||||
|
||||
/* Address to access the cycle counter low register of the RTC */
|
||||
#define __PATMOS_RTC_CYCLE_LOW_ADDR (&_timer_base + 0x00)
|
||||
|
||||
@@ -18,19 +18,44 @@
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
bool benchmark_timer_find_average_overhead;
|
||||
|
||||
#define AVG_OVERHEAD 0 /* It typically takes 0 microseconds */
|
||||
/* to start/stop the timer. */
|
||||
#define LEAST_VALID 1 /* Don't trust a value lower than this */
|
||||
|
||||
void benchmark_timer_initialize(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* Timer runs long and accurate enough not to require an interrupt.
|
||||
*/
|
||||
__PATMOS_RTC_WR_INTERVAL(PATMOS_INF);
|
||||
}
|
||||
|
||||
int benchmark_timer_read(void)
|
||||
{
|
||||
return 0;
|
||||
uint32_t total;
|
||||
|
||||
/*
|
||||
* Read the timer and see how many clicks it has been since we started.
|
||||
*/
|
||||
|
||||
__PATMOS_RTC_RD_INTERVAL(total);
|
||||
|
||||
total = (PATMOS_INF - total)/PATMOS_FREQ_MHZ;
|
||||
|
||||
if ( benchmark_timer_find_average_overhead == true )
|
||||
return total; /* in one microsecond units */
|
||||
|
||||
if ( total < LEAST_VALID )
|
||||
return 0; /* below timer resolution */
|
||||
|
||||
return total - AVG_OVERHEAD;
|
||||
}
|
||||
|
||||
void benchmark_timer_disable_subtracting_average_overhead(
|
||||
bool find_flag
|
||||
bool find_flag
|
||||
)
|
||||
{
|
||||
|
||||
benchmark_timer_find_average_overhead = find_flag;
|
||||
}
|
||||
|
||||
@@ -161,9 +161,6 @@ Alternatively, the 'build.sh' script in the T-CREST misc repository includes
|
||||
the '-t' option that runs the complete RTEMS testsuite for Patmos and checks
|
||||
its results.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user