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.
2 RTOS Support

Data Structures

struct  task_cycle_info_t
 
struct  task_cycle_info_agent_t
 

Macros

#define start_task_cycle_counter(...)    __start_task_cycle_counter((NULL,##__VA_ARGS__))
 
#define stop_task_cycle_counter(...)    __stop_task_cycle_counter((NULL,##__VA_ARGS__))
 

Typedefs

typedef struct task_cycle_info_agent_t task_cycle_info_agent_t
 

Functions

void init_task_cycle_counter (void)
 initialize the default virtual cycle counter for the current task More...
 
task_cycle_info_tget_rtos_task_cycle_info (void)
 provide cycle information for target task More...
 
task_cycle_info_tinit_task_cycle_info (task_cycle_info_t *ptInfo)
 intialize a given task_cycle_info_t object and enable it before registering it. More...
 
bool enable_task_cycle_info (task_cycle_info_t *ptInfo)
 enable a given task_cycle_info_t object More...
 
bool disable_task_cycle_info (task_cycle_info_t *ptInfo)
 disable a given task_cycle_info_t object More...
 
void resume_task_cycle_info (task_cycle_info_t *ptInfo, bool bEnabledStatus)
 resume the enabled status of a given task_cycle_info_t object More...
 
task_cycle_info_agent_tregister_task_cycle_agent (task_cycle_info_t *ptInfo, task_cycle_info_agent_t *ptAgent)
 register a global virtual cycle counter agent to the current task More...
 
task_cycle_info_agent_tunregister_task_cycle_agent (task_cycle_info_agent_t *ptAgent)
 remove a global virtual cycle counter agent from the current task More...
 

Detailed Description

Macro Definition Documentation

◆ start_task_cycle_counter

#define start_task_cycle_counter (   ...)     __start_task_cycle_counter((NULL,##__VA_ARGS__))

Definition at line 577 of file perf_counter.h.

◆ stop_task_cycle_counter

#define stop_task_cycle_counter (   ...)     __stop_task_cycle_counter((NULL,##__VA_ARGS__))

Definition at line 580 of file perf_counter.h.

Typedef Documentation

◆ task_cycle_info_agent_t

Definition at line 371 of file perf_counter.h.

Function Documentation

◆ disable_task_cycle_info()

bool disable_task_cycle_info ( task_cycle_info_t ptInfo)

disable a given task_cycle_info_t object

Parameters
[in]ptInfothe address of target task_cycle_info_t object
Returns
bool previous status

Definition at line 483 of file perf_counter.c.

◆ enable_task_cycle_info()

bool enable_task_cycle_info ( task_cycle_info_t ptInfo)

enable a given task_cycle_info_t object

Parameters
[in]ptInfothe address of target task_cycle_info_t object
Returns
bool previous status

Definition at line 470 of file perf_counter.c.

◆ get_rtos_task_cycle_info()

task_cycle_info_t * get_rtos_task_cycle_info ( void  )

provide cycle information for target task

Support RTOS List:

  • RTX5
  • RT-Thread
  • ThreadX
  • FreeRTOS
Returns
task_cycle_info_t* the cycle info object passed to this function

Definition at line 435 of file perf_counter.c.

Referenced by init_task_cycle_counter(), and register_task_cycle_agent().

◆ init_task_cycle_counter()

void init_task_cycle_counter ( void  )

initialize the default virtual cycle counter for the current task

Definition at line 440 of file perf_counter.c.

References get_rtos_task_cycle_info(), and get_system_ticks().

◆ init_task_cycle_info()

task_cycle_info_t * init_task_cycle_info ( task_cycle_info_t ptInfo)

intialize a given task_cycle_info_t object and enable it before registering it.

Returns
task_cycle_info_t* the cycle info object passed to this function

Definition at line 455 of file perf_counter.c.

◆ register_task_cycle_agent()

task_cycle_info_agent_t * register_task_cycle_agent ( task_cycle_info_t ptInfo,
task_cycle_info_agent_t ptAgent 
)

register a global virtual cycle counter agent to the current task

Parameters
[in]ptInfothe address of target task_cycle_info_t object
[in]ptAgentan list node for the task_cycle_info_t object
Note
the ptAgent it is better to be allocated as a static variable, global variable or comes from heap or pool
Returns
task_cycle_info_agent_t* the agent passed to this function

Definition at line 506 of file perf_counter.c.

References get_rtos_task_cycle_info().

◆ resume_task_cycle_info()

void resume_task_cycle_info ( task_cycle_info_t ptInfo,
bool  bEnabledStatus 
)

resume the enabled status of a given task_cycle_info_t object

Parameters
[in]ptInfothe address of target task_cycle_info_t object
[in]bEnabledStatusthe previous status

Definition at line 496 of file perf_counter.c.

◆ unregister_task_cycle_agent()

task_cycle_info_agent_t * unregister_task_cycle_agent ( task_cycle_info_agent_t ptAgent)

remove a global virtual cycle counter agent from the current task

Parameters
[in]ptAgentthe list node currently in use
Returns
task_cycle_info_agent_t* the agent passed to this function

remove agent from the next-list

Definition at line 545 of file perf_counter.c.