mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-01-31 19:33:04 +08:00
add __perfc_sync_barrier__();
This commit is contained in:
parent
e22be687f6
commit
4008b11d0c
@ -146,6 +146,7 @@ void update_perf_counter(void)
|
|||||||
|
|
||||||
__IRQ_SAFE {
|
__IRQ_SAFE {
|
||||||
g_lLastTimeStamp = get_system_ticks();
|
g_lLastTimeStamp = get_system_ticks();
|
||||||
|
__perfc_sync_barrier__();
|
||||||
g_nOffset = get_system_ticks() - g_lLastTimeStamp;
|
g_nOffset = get_system_ticks() - g_lLastTimeStamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +333,17 @@ __super_loop_monitor__()
|
|||||||
__asm(".global __ensure_systick_wrapper\n\t");
|
__asm(".global __ensure_systick_wrapper\n\t");
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#ifndef __perfc_sync_barrier__
|
||||||
|
|
||||||
|
/* default implementation */
|
||||||
|
#if defined(__clang__) || __IS_COMPILER_GCC__
|
||||||
|
# define __perfc_sync_barrier__(...) __sync_synchronize()
|
||||||
|
#else
|
||||||
|
# define __perfc_sync_barrier__(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
@ -358,7 +369,9 @@ __asm(".global __ensure_systick_wrapper\n\t");
|
|||||||
*/
|
*/
|
||||||
#define __cycleof__(__STR, ...) \
|
#define __cycleof__(__STR, ...) \
|
||||||
using(int64_t _ = get_system_ticks(), __cycle_count__ = _, \
|
using(int64_t _ = get_system_ticks(), __cycle_count__ = _, \
|
||||||
_=_, { \
|
{__perfc_sync_barrier__();}, \
|
||||||
|
{ \
|
||||||
|
__perfc_sync_barrier__(); \
|
||||||
_ = get_system_ticks() - _ - g_nOffset; \
|
_ = get_system_ticks() - _ - g_nOffset; \
|
||||||
__cycle_count__ = _; \
|
__cycle_count__ = _; \
|
||||||
if (__PLOOC_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
|
if (__PLOOC_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
/*============================ MACROS ========================================*/
|
/*============================ MACROS ========================================*/
|
||||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||||
|
|
||||||
|
#ifndef __perfc_sync_barrier__
|
||||||
|
# define __perfc_sync_barrier__(...) do {__DSB();__ISB();} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*============================ TYPES =========================================*/
|
/*============================ TYPES =========================================*/
|
||||||
typedef uint32_t perfc_global_interrupt_status_t;
|
typedef uint32_t perfc_global_interrupt_status_t;
|
||||||
|
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
|
|
||||||
/*============================ MACROS ========================================*/
|
/*============================ MACROS ========================================*/
|
||||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||||
|
#ifndef __perfc_sync_barrier__
|
||||||
|
# define __perfc_sync_barrier__(...) do {__DSB();__ISB();} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define __cpu_perf__(__str, ...) \
|
#define __cpu_perf__(__str, ...) \
|
||||||
using( \
|
using( \
|
||||||
struct { \
|
struct { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user