aboutsummaryrefslogtreecommitdiff
path: root/src/modules/systemlib/perf_counter.h
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-01-07 17:14:46 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-01-11 11:03:55 +0100
commita3bce71b97b6e958737d11414cce2609e5d4848d (patch)
tree25bf5c8c021a5dcf411359d2a5c7b27418526f86 /src/modules/systemlib/perf_counter.h
parent1507d479e099549a81c99fd9f702b4a278fa763d (diff)
downloadpx4-firmware-a3bce71b97b6e958737d11414cce2609e5d4848d.tar.gz
px4-firmware-a3bce71b97b6e958737d11414cce2609e5d4848d.tar.bz2
px4-firmware-a3bce71b97b6e958737d11414cce2609e5d4848d.zip
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.
Diffstat (limited to 'src/modules/systemlib/perf_counter.h')
-rw-r--r--src/modules/systemlib/perf_counter.h12
1 files changed, 11 insertions, 1 deletions
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.
@@ -66,6 +66,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.