aboutsummaryrefslogtreecommitdiff
path: root/src/modules/systemlib/perf_counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/systemlib/perf_counter.h')
-rw-r--r--src/modules/systemlib/perf_counter.h24
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.