summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/statistics.h
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-11-02 15:57:34 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-11-02 15:57:34 +0100
commitd7b0577d7d30139491b5cfeffb467440f9e88818 (patch)
tree0666fa8f415a47e8f5645dd87ad8844251251c6a /include/osmocom/core/statistics.h
parentc84851bccc2e5e60536afa474a5f13134a3b79c9 (diff)
parent8f0374f7521376bdb721e821047e8a6a4a727283 (diff)
Merge branch 'jerlbeck/wip/stats'
* This adds a new counter type (to measure time or delay) * A statsd reporting backend. This can be fed into graphite or similar tools. * A periodic log backend for performance values
Diffstat (limited to 'include/osmocom/core/statistics.h')
-rw-r--r--include/osmocom/core/statistics.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/osmocom/core/statistics.h b/include/osmocom/core/statistics.h
index de250bec..1e472ffd 100644
--- a/include/osmocom/core/statistics.h
+++ b/include/osmocom/core/statistics.h
@@ -9,6 +9,7 @@ struct osmo_counter {
const char *name; /*!< \brief human-readable name */
const char *description; /*!< \brief humn-readable description */
unsigned long value; /*!< \brief current value */
+ unsigned long previous; /*!< \brief previous value */
};
/*! \brief Increment counter */
@@ -37,8 +38,8 @@ struct osmo_counter *osmo_counter_alloc(const char *name);
*/
void osmo_counter_free(struct osmo_counter *ctr);
-/*! \brief Iteate over all counters
- * \param[in] handle_counter Call-back function
+/*! \brief Iterate over all counters
+ * \param[in] handle_counter Call-back function, aborts if rc < 0
* \param[in] data Private dtata handed through to \a handle_counter
*/
int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *), void *data);
@@ -48,3 +49,6 @@ int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *),
* \returns pointer to counter (\ref osmo_counter) or NULL otherwise
*/
struct osmo_counter *osmo_counter_get_by_name(const char *name);
+
+/*! \brief Return the counter difference since the last call to this function */
+int osmo_counter_difference(struct osmo_counter *ctr);