diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-15 12:42:28 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-15 12:42:28 +0100 |
commit | 96db9e81883ab0e3438e8ffdce8e8dce47d204ce (patch) | |
tree | 2d41d99f2837630219cc56699b27d2a2190374aa /src/modules/systemlib/perf_counter.h | |
parent | e60c1a842c856e1a19fcdc1b169dfdbc813e9ce2 (diff) | |
parent | e62bd37e73139c77f0d60cd91fe3443ed23df074 (diff) | |
download | px4-firmware-96db9e81883ab0e3438e8ffdce8e8dce47d204ce.tar.gz px4-firmware-96db9e81883ab0e3438e8ffdce8e8dce47d204ce.tar.bz2 px4-firmware-96db9e81883ab0e3438e8ffdce8e8dce47d204ce.zip |
Merge remote-tracking branch 'upstream/master' into ros
Conflicts:
src/platforms/px4_middleware.h
Diffstat (limited to 'src/modules/systemlib/perf_counter.h')
-rw-r--r-- | src/modules/systemlib/perf_counter.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/modules/systemlib/perf_counter.h b/src/modules/systemlib/perf_counter.h index 49590c086..8543ba7bb 100644 --- a/src/modules/systemlib/perf_counter.h +++ b/src/modules/systemlib/perf_counter.h @@ -57,7 +57,7 @@ typedef struct perf_ctr_header *perf_counter_t; __BEGIN_DECLS /** - * Create a new counter. + * Create a new local counter. * * @param type The type of the new counter. * @param name The counter name. @@ -67,6 +67,16 @@ __BEGIN_DECLS __EXPORT extern perf_counter_t perf_alloc(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. + * + * @param type The type of the counter. + * @param name The counter name. + * @return Handle for the counter, or NULL if a counter + * could not be allocated. + */ +__EXPORT extern perf_counter_t perf_alloc_once(enum perf_counter_type type, const char *name); + +/** * Free a counter. * * @param handle The performance counter's handle. @@ -103,6 +113,18 @@ __EXPORT extern void perf_begin(perf_counter_t handle); __EXPORT extern void perf_end(perf_counter_t handle); /** + * 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. + * + * @param handle The handle returned from perf_alloc. + * @param elapsed The time elapsed. Negative values lead to incrementing the overrun counter. + */ +__EXPORT extern void perf_set(perf_counter_t handle, int64_t elapsed); + +/** * Cancel a performance event. * * This call applies to counters that operate over ranges of time; PC_ELAPSED etc. |