perf_counter v2.1.0
A dedicated performance counter for Cortex-M Systick. It shares the SysTick with users' original SysTick function(s) without interfering with it.
4 Helper

Macros

#define UNUSED_PARAM(__VAR)   (void)(__VAR)
 
#define ALT_CONNECT2(__A, __B)   __CONNECT2(__A, __B)
 
#define CONNECT2(__A, __B)   __CONNECT2(__A, __B)
 
#define CONNECT3(__A, __B, __C)   __CONNECT3(__A, __B, __C)
 
#define CONNECT4(__A, __B, __C, __D)   __CONNECT4(__A, __B, __C, __D)
 
#define CONNECT5(__A, __B, __C, __D, __E)   __CONNECT5(__A, __B, __C, __D, __E)
 
#define CONNECT6(__A, __B, __C, __D, __E, __F)    __CONNECT6(__A, __B, __C, __D, __E, __F)
 
#define CONNECT7(__A, __B, __C, __D, __E, __F, __G)    __CONNECT7(__A, __B, __C, __D, __E, __F, __G)
 
#define CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H)    __CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H)
 
#define CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)    __CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)
 
#define CONNECT(...)    ALT_CONNECT2(CONNECT, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
 
#define using(...)    CONNECT2(__using, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
 
#define with(...)    CONNECT2(__with, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
 
#define dimof(__array)   (sizeof(__array)/sizeof(__array[0]))
 
#define SAFE_NAME(__NAME)   CONNECT3(__,__NAME,__LINE__)
 
#define foreach2(__type, __array)
 
#define foreach3(__type, __array, __item)
 
#define foreach(...)    CONNECT2(foreach, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
 
#define safe_atom_code()
 

Detailed Description

Macro Definition Documentation

◆ ALT_CONNECT2

#define ALT_CONNECT2 (   __A,
  __B 
)    __CONNECT2(__A, __B)

Definition at line 171 of file perf_counter.h.

◆ CONNECT

#define CONNECT (   ...)     ALT_CONNECT2(CONNECT, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)

Definition at line 185 of file perf_counter.h.

◆ CONNECT2

#define CONNECT2 (   __A,
  __B 
)    __CONNECT2(__A, __B)

Definition at line 172 of file perf_counter.h.

◆ CONNECT3

#define CONNECT3 (   __A,
  __B,
  __C 
)    __CONNECT3(__A, __B, __C)

Definition at line 173 of file perf_counter.h.

◆ CONNECT4

#define CONNECT4 (   __A,
  __B,
  __C,
  __D 
)    __CONNECT4(__A, __B, __C, __D)

Definition at line 174 of file perf_counter.h.

◆ CONNECT5

#define CONNECT5 (   __A,
  __B,
  __C,
  __D,
  __E 
)    __CONNECT5(__A, __B, __C, __D, __E)

Definition at line 175 of file perf_counter.h.

◆ CONNECT6

#define CONNECT6 (   __A,
  __B,
  __C,
  __D,
  __E,
  __F 
)     __CONNECT6(__A, __B, __C, __D, __E, __F)

Definition at line 176 of file perf_counter.h.

◆ CONNECT7

#define CONNECT7 (   __A,
  __B,
  __C,
  __D,
  __E,
  __F,
  __G 
)     __CONNECT7(__A, __B, __C, __D, __E, __F, __G)

Definition at line 178 of file perf_counter.h.

◆ CONNECT8

#define CONNECT8 (   __A,
  __B,
  __C,
  __D,
  __E,
  __F,
  __G,
  __H 
)     __CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H)

Definition at line 180 of file perf_counter.h.

◆ CONNECT9

#define CONNECT9 (   __A,
  __B,
  __C,
  __D,
  __E,
  __F,
  __G,
  __H,
  __I 
)     __CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)

Definition at line 182 of file perf_counter.h.

◆ dimof

#define dimof (   __array)    (sizeof(__array)/sizeof(__array[0]))

Definition at line 238 of file perf_counter.h.

◆ foreach

#define foreach (   ...)     CONNECT2(foreach, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)

Definition at line 262 of file perf_counter.h.

◆ foreach2

#define foreach2 (   __type,
  __array 
)
Value:
using(__type *_ = __array) \
for ( uint_fast32_t SAFE_NAME(count) = dimof(__array); \
SAFE_NAME(count) > 0; \
_++, SAFE_NAME(count)-- \
)

Definition at line 248 of file perf_counter.h.

◆ foreach3

#define foreach3 (   __type,
  __array,
  __item 
)
Value:
using(__type *_ = __array, *__item = _, _ = _, _ = _ ) \
for ( uint_fast32_t SAFE_NAME(count) = dimof(__array); \
SAFE_NAME(count) > 0; \
_++, __item = _, SAFE_NAME(count)-- \
)

Definition at line 255 of file perf_counter.h.

◆ safe_atom_code

#define safe_atom_code ( )
Value:
using( uint32_t SAFE_NAME(temp) = \
({ uint32_t SAFE_NAME(temp2)=__get_PRIMASK(); \
__disable_irq(); \
SAFE_NAME(temp2);}), \
__set_PRIMASK(SAFE_NAME(temp)))

Definition at line 266 of file perf_counter.h.

◆ SAFE_NAME

#define SAFE_NAME (   __NAME)    CONNECT3(__,__NAME,__LINE__)

Definition at line 242 of file perf_counter.h.

◆ UNUSED_PARAM

#define UNUSED_PARAM (   __VAR)    (void)(__VAR)

Definition at line 133 of file perf_counter.h.

◆ using

#define using (   ...)     CONNECT2(__using, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)

Definition at line 219 of file perf_counter.h.

◆ with

#define with (   ...)     CONNECT2(__with, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)

Definition at line 232 of file perf_counter.h.