QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
stats.h
Go to the documentation of this file.
1 
15 #include "qev.h"
16 
26 #define qev_stats_counter_inc(counter) qev_stats_counter_add(counter, 1);
27 
37 #define qev_stats_counter_dec(counter) qev_stats_counter_add(counter, -1);
38 
47 #define qev_stats_time(timer, block) { \
48  gint64 qev_stats_timer_start = g_get_monotonic_time(); \
49  block; \
50  qev_stats_timer_record(timer, g_get_monotonic_time() - qev_stats_timer_start); }
51 
59  gboolean active;
60 
64  gboolean has_warn;
65 
69  gboolean warn_greater;
70 
74  gint64 warn;
75 
79  gboolean has_crit;
80 
84  gboolean crit_greater;
85 
89  gint64 crit;
90 };
91 
119 typedef gint (*qev_stats_monitor_fn)(
120  const gint64 val,
121  const struct qev_stats_threshold thresh,
122  GString *msg);
123 
128 
133 
138 
154  const gchar *prefix,
155  const gchar *name,
156  const gchar *description);
157 
175  const gchar *prefix,
176  const gchar *name,
177  const qev_stats_monitor_fn monitor,
178  const gchar *description);
179 
188 void qev_stats_gauge_set(qev_stats_gauge_t *gauge, gint64 val);
189 
200 
219  const gchar *prefix,
220  const gchar *name,
221  const gboolean reset_on_flush,
222  const gchar *description);
223 
244  const gchar *prefix,
245  const gchar *name,
246  const gboolean reset_on_flush,
247  const qev_stats_monitor_fn monitor,
248  const gchar *description);
249 
261 gint64 qev_stats_counter_add(qev_stats_counter_t *counter, const gint64 val);
262 
273 
289  const gchar *prefix,
290  const gchar *name,
291  const gchar *description);
292 
320  const gchar *prefix,
321  const gchar *name,
322  const qev_stats_monitor_fn monitor_sum,
323  const qev_stats_monitor_fn monitor_stddev,
324  const qev_stats_monitor_fn monitor_mean,
325  const qev_stats_monitor_fn monitor_max,
326  const qev_stats_monitor_fn monitor_min,
327  const qev_stats_monitor_fn monitor_count,
328  const gchar *description);
329 
339  qev_stats_timer_t *timer,
340  const gint64 us);
gboolean active
If the threshold has been configured and is active.
Definition: stats.h:59
void qev_stats_gauge_set(qev_stats_gauge_t *gauge, gint64 val)
Set the gauge to the given value.
gint64 qev_stats_counter_add(qev_stats_counter_t *counter, const gint64 val)
Add the given value to the counter.
qev_stats_gauge_t * qev_stats_gauge(const gchar *prefix, const gchar *name, const gchar *description)
Adds a gauge to the stats lineup.
struct qev_stats_timer qev_stats_timer_t
A timer stat.
Definition: stats.h:137
void qev_stats_timer_record(qev_stats_timer_t *timer, const gint64 us)
Records a time to the timer.
qev_stats_gauge_t * qev_stats_gauge_monitor(const gchar *prefix, const gchar *name, const qev_stats_monitor_fn monitor, const gchar *description)
Adds a gauge to the stats lineup.
For determining if something should be alerted on.
Definition: stats.h:55
qev_stats_timer_t * qev_stats_timer_monitor(const gchar *prefix, const gchar *name, const qev_stats_monitor_fn monitor_sum, const qev_stats_monitor_fn monitor_stddev, const qev_stats_monitor_fn monitor_mean, const qev_stats_monitor_fn monitor_max, const qev_stats_monitor_fn monitor_min, const qev_stats_monitor_fn monitor_count, const gchar *description)
Adds a timer to the stats lineup.
gboolean has_crit
If there is a warn value for this threshold.
Definition: stats.h:79
gboolean warn_greater
The compare for warn is greater.
Definition: stats.h:69
gint(* qev_stats_monitor_fn)(const gint64 val, const struct qev_stats_threshold thresh, GString *msg)
A custom monitoring function.
Definition: stats.h:119
gint64 qev_stats_counter_get(qev_stats_counter_t *counter)
Get the given value to the counter at this instant.
qev_stats_timer_t * qev_stats_timer(const gchar *prefix, const gchar *name, const gchar *description)
Adds a timer to the stats lineup.
qev_stats_counter_t * qev_stats_counter_monitor(const gchar *prefix, const gchar *name, const gboolean reset_on_flush, const qev_stats_monitor_fn monitor, const gchar *description)
Adds a counter to the stats lineup.
gint64 warn
If warn_greater, warn when val > warn, otherwise when val < warn.
Definition: stats.h:74
gboolean crit_greater
The compare for critical is greater.
Definition: stats.h:84
gboolean has_warn
If there is a warn value for this threshold.
Definition: stats.h:64
gint64 crit
If crit_greater, warn when val > crit, otherwise when val < crit.
Definition: stats.h:89
Provides all the qev_* functions that are needed for creating an event loop.
qev_stats_counter_t * qev_stats_counter(const gchar *prefix, const gchar *name, const gboolean reset_on_flush, const gchar *description)
Adds a counter to the stats lineup.
struct qev_stats_gauge qev_stats_gauge_t
A gauge stat.
Definition: stats.h:127
gint64 qev_stats_gauge_get(qev_stats_gauge_t *gauge)
Get the value of the gauge right now.
struct qev_stats_counter qev_stats_counter_t
A counter stat.
Definition: stats.h:132