mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-02-07 19:34:18 +08:00
update __cpu_time__ to support RTOS
This commit is contained in:
parent
0a84512a24
commit
1382df9645
@ -75,7 +75,7 @@
|
|||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>0</IsCurrentTarget>
|
<IsCurrentTarget>1</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>7</CpuCode>
|
<CpuCode>7</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
@ -297,7 +297,7 @@
|
|||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>1</IsCurrentTarget>
|
<IsCurrentTarget>0</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>7</CpuCode>
|
<CpuCode>7</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
@ -195,9 +195,9 @@ int main (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__cpu_time__(10) {
|
__cpu_time__(10) {
|
||||||
delay_us(3000);
|
delay_us(30000);
|
||||||
}
|
}
|
||||||
delay_us(7000);
|
delay_us(70000);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -357,9 +357,9 @@ __asm(".global __ensure_systick_wrapper\n\t");
|
|||||||
#define __cpu_time__(__CNT, ...) \
|
#define __cpu_time__(__CNT, ...) \
|
||||||
static int64_t SAFE_NAME(s_lTimestamp) = 0, SAFE_NAME(s_lTotal) = 0; \
|
static int64_t SAFE_NAME(s_lTimestamp) = 0, SAFE_NAME(s_lTotal) = 0; \
|
||||||
static uint32_t s_wLoopCounter = (__CNT); \
|
static uint32_t s_wLoopCounter = (__CNT); \
|
||||||
using(int64_t lStart = 0, ({ \
|
using(float __usage__ = 0, ({ \
|
||||||
if (0 == s_wLoopCounter) { \
|
if (0 == s_wLoopCounter) { \
|
||||||
float __usage__ = (float)((double)SAFE_NAME(s_lTotal) \
|
__usage__ = (float)((double)SAFE_NAME(s_lTotal) \
|
||||||
/ (double)( get_system_ticks() \
|
/ (double)( get_system_ticks() \
|
||||||
- SAFE_NAME(s_lTimestamp))); \
|
- SAFE_NAME(s_lTimestamp))); \
|
||||||
__usage__ *= 100.0f; \
|
__usage__ *= 100.0f; \
|
||||||
@ -375,8 +375,8 @@ __asm(".global __ensure_systick_wrapper\n\t");
|
|||||||
SAFE_NAME(s_lTimestamp) = get_system_ticks(); \
|
SAFE_NAME(s_lTimestamp) = get_system_ticks(); \
|
||||||
s_wLoopCounter = (__CNT); \
|
s_wLoopCounter = (__CNT); \
|
||||||
} \
|
} \
|
||||||
lStart = get_system_ticks();}), \
|
start_task_cycle_counter();}), \
|
||||||
({SAFE_NAME(s_lTotal) += get_system_ticks() - lStart; \
|
({SAFE_NAME(s_lTotal) += stop_task_cycle_counter(); \
|
||||||
s_wLoopCounter--;}))
|
s_wLoopCounter--;}))
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Binary file not shown.
@ -357,9 +357,9 @@ __asm(".global __ensure_systick_wrapper\n\t");
|
|||||||
#define __cpu_time__(__CNT, ...) \
|
#define __cpu_time__(__CNT, ...) \
|
||||||
static int64_t SAFE_NAME(s_lTimestamp) = 0, SAFE_NAME(s_lTotal) = 0; \
|
static int64_t SAFE_NAME(s_lTimestamp) = 0, SAFE_NAME(s_lTotal) = 0; \
|
||||||
static uint32_t s_wLoopCounter = (__CNT); \
|
static uint32_t s_wLoopCounter = (__CNT); \
|
||||||
using(int64_t lStart = 0, ({ \
|
using(float __usage__ = 0, ({ \
|
||||||
if (0 == s_wLoopCounter) { \
|
if (0 == s_wLoopCounter) { \
|
||||||
float __usage__ = (float)((double)SAFE_NAME(s_lTotal) \
|
__usage__ = (float)((double)SAFE_NAME(s_lTotal) \
|
||||||
/ (double)( get_system_ticks() \
|
/ (double)( get_system_ticks() \
|
||||||
- SAFE_NAME(s_lTimestamp))); \
|
- SAFE_NAME(s_lTimestamp))); \
|
||||||
__usage__ *= 100.0f; \
|
__usage__ *= 100.0f; \
|
||||||
@ -375,8 +375,8 @@ __asm(".global __ensure_systick_wrapper\n\t");
|
|||||||
SAFE_NAME(s_lTimestamp) = get_system_ticks(); \
|
SAFE_NAME(s_lTimestamp) = get_system_ticks(); \
|
||||||
s_wLoopCounter = (__CNT); \
|
s_wLoopCounter = (__CNT); \
|
||||||
} \
|
} \
|
||||||
lStart = get_system_ticks();}), \
|
start_task_cycle_counter();}), \
|
||||||
({SAFE_NAME(s_lTotal) += get_system_ticks() - lStart; \
|
({SAFE_NAME(s_lTotal) += stop_task_cycle_counter(); \
|
||||||
s_wLoopCounter--;}))
|
s_wLoopCounter--;}))
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user