From a3bce71b97b6e958737d11414cce2609e5d4848d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 7 Jan 2015 17:14:46 +0100 Subject: Performance counters: Estimate RMS for elapsed counters. Allow to use a perf counter across processes, deal with overruns and other resulting inconsistencies from cross-process use. --- src/modules/systemlib/perf_counter.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/modules/systemlib/perf_counter.h') diff --git a/src/modules/systemlib/perf_counter.h b/src/modules/systemlib/perf_counter.h index d06606a5d..92f064d04 100644 --- a/src/modules/systemlib/perf_counter.h +++ b/src/modules/systemlib/perf_counter.h @@ -56,7 +56,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. @@ -65,6 +65,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. * -- cgit v1.2.3