Added performance counter
This commit is contained in:
parent
f07189b1be
commit
2ab0dd77de
1 changed files with 25 additions and 0 deletions
|
@ -131,6 +131,31 @@
|
|||
|
||||
#define FEATURE_FLAG_ASSERT(flag, id) STATIC_ASSERT(flag > TEMP_FLAGS_END || flag == 0, id)
|
||||
|
||||
#ifndef NDEBUG
|
||||
static inline void CycleCountStart()
|
||||
{
|
||||
REG_TM2CNT_H = 0;
|
||||
REG_TM3CNT_H = 0;
|
||||
|
||||
REG_TM2CNT_L = 0;
|
||||
REG_TM3CNT_L = 0;
|
||||
|
||||
// init timers (tim3 count up mode, tim2 every clock cycle)
|
||||
REG_TM3CNT_H = TIMER_ENABLE | TIMER_COUNTUP;
|
||||
REG_TM2CNT_H = TIMER_1CLK | TIMER_ENABLE;
|
||||
}
|
||||
|
||||
static inline u32 CycleCountEnd()
|
||||
{
|
||||
// stop timers
|
||||
REG_TM2CNT_H = 0;
|
||||
REG_TM3CNT_H = 0;
|
||||
|
||||
// return result
|
||||
return REG_TM2CNT_L | (REG_TM3CNT_L << 16u);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct Coords8
|
||||
{
|
||||
s8 x;
|
||||
|
|
Loading…
Reference in a new issue