Firmware
|
Performance measuring tools. More...
Go to the source code of this file.
Macros | |
#define | _SYSTEMLIB_PERF_COUNTER_H value |
#define | LATENCY_BUCKET_COUNT 8 |
Typedefs | |
typedef struct perf_ctr_header * | perf_counter_t |
typedef void(* | perf_callback) (perf_counter_t handle, void *user) |
Enumerations | |
enum | perf_counter_type { PC_COUNT, PC_ELAPSED, PC_INTERVAL } |
Counter types. More... | |
Functions | |
__BEGIN_DECLS __EXPORT perf_counter_t | perf_alloc (enum perf_counter_type type, const char *name) |
Create a new local counter. More... | |
__EXPORT perf_counter_t | perf_alloc_once (enum perf_counter_type type, const char *name) |
Get the reference to an existing counter or create a new one if it does not exist. More... | |
__EXPORT void | perf_free (perf_counter_t handle) |
Free a counter. More... | |
__EXPORT void | perf_count (perf_counter_t handle) |
Count a performance event. More... | |
__EXPORT void | perf_begin (perf_counter_t handle) |
Begin a performance event. More... | |
__EXPORT void | perf_end (perf_counter_t handle) |
End a performance event. More... | |
__EXPORT void | perf_set_elapsed (perf_counter_t handle, int64_t elapsed) |
Register a measurement. More... | |
__EXPORT void | perf_set_count (perf_counter_t handle, uint64_t count) |
Set a counter. More... | |
__EXPORT void | perf_cancel (perf_counter_t handle) |
Cancel a performance event. More... | |
__EXPORT void | perf_reset (perf_counter_t handle) |
Reset a performance counter. More... | |
__EXPORT void | perf_print_counter (perf_counter_t handle) |
Print one performance counter to stdout. More... | |
__EXPORT void | perf_print_counter_fd (int fd, perf_counter_t handle) |
Print one performance counter to a fd. More... | |
__EXPORT int | perf_print_counter_buffer (char *buffer, int length, perf_counter_t handle) |
Print one performance counter to a buffer. More... | |
__EXPORT void | perf_print_all (int fd) |
Print all of the performance counters. More... | |
__EXPORT void | perf_iterate_all (perf_callback cb, void *user) |
Iterate over all performance counters using a callback. More... | |
__EXPORT void | perf_print_latency (int fd) |
Print hrt latency counters. More... | |
__EXPORT void | perf_reset_all (void) |
Reset all of the performance counters. | |
__EXPORT uint64_t | perf_event_count (perf_counter_t handle) |
Return current event_count. More... | |
Variables | |
const uint16_t | latency_bucket_count |
const uint16_t | latency_buckets [LATENCY_BUCKET_COUNT] |
uint32_t | latency_counters [LATENCY_BUCKET_COUNT+1] |
Performance measuring tools.
enum perf_counter_type |
__BEGIN_DECLS __EXPORT perf_counter_t perf_alloc | ( | enum perf_counter_type | type, |
const char * | name | ||
) |
Create a new local counter.
type | The type of the new counter. |
name | The counter name. |
__EXPORT perf_counter_t perf_alloc_once | ( | enum perf_counter_type | type, |
const char * | name | ||
) |
Get the reference to an existing counter or create a new one if it does not exist.
type | The type of the counter. |
name | The counter name. |
__EXPORT void perf_begin | ( | perf_counter_t | handle | ) |
Begin a performance event.
This call applies to counters that operate over ranges of time; PC_ELAPSED etc.
handle | The handle returned from perf_alloc. |
__EXPORT void perf_cancel | ( | perf_counter_t | handle | ) |
Cancel a performance event.
This call applies to counters that operate over ranges of time; PC_ELAPSED etc. It reverts the effect of a previous perf_begin.
handle | The handle returned from perf_alloc. |
__EXPORT void perf_count | ( | perf_counter_t | handle | ) |
Count a performance event.
This call only affects counters that take single events; PC_COUNT, PC_INTERVAL etc.
handle | The handle returned from perf_alloc. |
__EXPORT void perf_end | ( | perf_counter_t | handle | ) |
End a performance event.
This call applies to counters that operate over ranges of time; PC_ELAPSED etc. If a call is made without a corresponding perf_begin call, or if perf_cancel has been called subsequently, no change is made to the counter.
handle | The handle returned from perf_alloc. |
__EXPORT uint64_t perf_event_count | ( | perf_counter_t | handle | ) |
Return current event_count.
handle | The counter returned from perf_alloc. |
__EXPORT void perf_free | ( | perf_counter_t | handle | ) |
Free a counter.
handle | The performance counter's handle. |
__EXPORT void perf_iterate_all | ( | perf_callback | cb, |
void * | user | ||
) |
Iterate over all performance counters using a callback.
Caution: This will aquire the mutex, so do not call any other perf_* method that aquire the mutex as well from the callback (If this is needed, configure the mutex to be reentrant).
cb | callback method |
user | custom argument for the callback |
__EXPORT void perf_print_all | ( | int | fd | ) |
Print all of the performance counters.
fd | File descriptor to print to - e.g. 0 for stdout |
__EXPORT void perf_print_counter | ( | perf_counter_t | handle | ) |
Print one performance counter to stdout.
handle | The counter to print. |
__EXPORT int perf_print_counter_buffer | ( | char * | buffer, |
int | length, | ||
perf_counter_t | handle | ||
) |
Print one performance counter to a buffer.
buffer | buffer to write to |
length | buffer length |
handle | The counter to print. |
return | number of bytes written |
__EXPORT void perf_print_counter_fd | ( | int | fd, |
perf_counter_t | handle | ||
) |
Print one performance counter to a fd.
fd | File descriptor to print to - e.g. 0 for stdout |
handle | The counter to print. |
__EXPORT void perf_print_latency | ( | int | fd | ) |
Print hrt latency counters.
fd | File descriptor to print to - e.g. 0 for stdout |
__EXPORT void perf_reset | ( | perf_counter_t | handle | ) |
Reset a performance counter.
This call resets performance counter to initial state
handle | The handle returned from perf_alloc. |
__EXPORT void perf_set_count | ( | perf_counter_t | handle, |
uint64_t | count | ||
) |
Set a counter.
This call applies to counters of type PC_COUNT. It (re-)sets the count.
handle | The handle returned from perf_alloc. |
count | The counter value to be set. |
__EXPORT void perf_set_elapsed | ( | perf_counter_t | handle, |
int64_t | elapsed | ||
) |
Register a measurement.
This call applies to counters that operate over ranges of time; PC_ELAPSED etc. If a call is made without a corresponding perf_begin call. It sets the value provided as argument as a new measurement.
handle | The handle returned from perf_alloc. |
elapsed | The time elapsed. Negative values lead to incrementing the overrun counter. |