Profiler macros. More...

Macros

#define DEFINE_PROFILER(name, ...)   extern const char PROFILER_ ## name ## _ID[];
 Define a new profiler. More...
 
#define PROFILER_REGISTER_ALL()   profiler_register_all()
 Register all profilers. More...
 
#define PROFILER_REGISTER(name, config)   profiler_register(name, config)
 Register profiler with config. More...
 
#define PROFILER_UNREGISTER(name)   profiler_unregister(name)
 Unregister profiler. More...
 
#define PROFILER_SET_PARENT(name, parent)   profiler_set_parent(name, parent)
 Specify a profiler's parent. More...
 
#define PROFILER_BEGIN(name)   profiler_begin(name)
 Start profiler. More...
 
#define PROFILER_END(name)   profiler_end(name)
 Stop profiler. More...
 
#define PROFILER_MARK(name, start)   start ? profiler_begin(name) : profiler_end(name)
 Start or stop a profiler. More...
 
#define PROFILER_PRINT_STATUS(name)   profiler_print_status(name)
 Print a profiler's status. More...
 
#define PROFILER_PRINT_ALL_STATUSES()   profiler_print_status(NULL)
 Print the status of all profilers. More...
 
#define PROFILER_GET_STATUS(name, status)   profiler_get_status(name, status)
 Retrieve the status of a profiler. More...
 
#define PROFILER_RESET(name)   profiler_reset(name)
 Reset a profiler. More...
 
#define PROFILER_RESET_ALL()   profiler_reset(NULL)
 Reset all profilers. More...
 

Detailed Description

Profiler macros.

Macro Definition Documentation

◆ DEFINE_PROFILER

#define DEFINE_PROFILER (   name,
  ... 
)    extern const char PROFILER_ ## name ## _ID[];

Define a new profiler.

This allows for automatically registering profilers. This should be used in a custom header file named: app_profiler_definitions.h All profilers should be defined in this header file.

Then at the start of the app, call PROFILER_REGISTER_ALL() to automatially register all profilers.

Parameters
nameThe name of the profiler to define
Examples:
utility/profiler/app_profiler_definitions.h.

◆ PROFILER_BEGIN

#define PROFILER_BEGIN (   name)    profiler_begin(name)

Start profiler.

Start the profiler with the specified name.

Note
It is recommended to use this macro over the profiler_begin() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameThe name of the profiler as a string
Examples:
utility/profiler/main.c.

◆ PROFILER_END

#define PROFILER_END (   name)    profiler_end(name)

Stop profiler.

Stop the profiler with the specified name.

Note
It is recommended to use this macro over the profiler_end() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameThe name of the profiler as a string
Examples:
utility/profiler/main.c.

◆ PROFILER_GET_STATUS

#define PROFILER_GET_STATUS (   name,
  status 
)    profiler_get_status(name, status)

Retrieve the status of a profiler.

Retrieve the status of a specific profiler and populate a profiler_status_t

Note
It is recommended to use this macro over the profiler_get_status() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameName of the profile as a string
statusprofiler_status_t object to hold profiler status

◆ PROFILER_MARK

#define PROFILER_MARK (   name,
  start 
)    start ? profiler_begin(name) : profiler_end(name)

Start or stop a profiler.

This starts/stops a profiler from recording.

Parameters
nameName of the profile as a string
starttrue to start profile, false to stop

◆ PROFILER_PRINT_ALL_STATUSES

#define PROFILER_PRINT_ALL_STATUSES ( )    profiler_print_status(NULL)

Print the status of all profilers.

Print the status of all profilers to the log bus.

Note
It is recommended to use this macro over the profiler_print_status() API as profiling can be disabled via PROFILER_DISABLED global define.
Examples:
utility/profiler/main.c.

◆ PROFILER_PRINT_STATUS

#define PROFILER_PRINT_STATUS (   name)    profiler_print_status(name)

Print a profiler's status.

Print the status of the specified profiler to the log bus.

Note
It is recommended to use this macro over the profiler_print_status() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameName of the profile as a string

◆ PROFILER_REGISTER

#define PROFILER_REGISTER (   name,
  config 
)    profiler_register(name, config)

Register profiler with config.

Register a profiler with a custom config, profiler_config_t

See PROFILER_REGISTER_ALL() to register all profilers automatically.

Note
It is recommended to use this macro over the profiler_register() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameThe name of the profiler as a string
configprofiler_config_t profiler configuration, leave NULL to use default config

◆ PROFILER_REGISTER_ALL

#define PROFILER_REGISTER_ALL ( )    profiler_register_all()

Register all profilers.

Register all profilers defined in app_profiler_definitions.h See DEFINE_PROFILER for more details.

Note
It is recommended to use this macro over the profiler_register_all() API as the profiling can be disabled via PROFILER_DISABLED global define.
Examples:
utility/profiler/main.c.

◆ PROFILER_RESET

#define PROFILER_RESET (   name)    profiler_reset(name)

Reset a profiler.

Reset a specific profiler's stats

Note
It is recommended to use this macro over the profiler_reset() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameName of the profile as a string

◆ PROFILER_RESET_ALL

#define PROFILER_RESET_ALL ( )    profiler_reset(NULL)

Reset all profilers.

Reset all profiler's stats

Note
It is recommended to use this macro over the profiler_reset() API as profiling can be disabled via PROFILER_DISABLED global define.
Examples:
utility/profiler/main.c.

◆ PROFILER_SET_PARENT

#define PROFILER_SET_PARENT (   name,
  parent 
)    profiler_set_parent(name, parent)

Specify a profiler's parent.

Specify the parent of a profiler

Note
It is recommended to use this macro over the profiler_set_parent() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameName of profiler
parentName of parent profiler

◆ PROFILER_UNREGISTER

#define PROFILER_UNREGISTER (   name)    profiler_unregister(name)

Unregister profiler.

Unregister a previously register profiler with the given name.

Note
It is recommended to use this macro over the profiler_unregister() API as profiling can be disabled via PROFILER_DISABLED global define.
Parameters
nameThe name of the profiler as a string