diff options
author | Thomas Graf <tgraf@suug.ch> | 2016-01-29 12:11:44 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2016-01-29 12:11:44 +0100 |
commit | 4efaa8ce9e82777d1208688e5bad833043587d81 (patch) | |
tree | 8e7216b8ee66bbbe754e40f82a6bee656d3b41bb /include | |
parent | 1f79ea4396d4e1fb7d7042ab54552b33f082c7dc (diff) |
curses: Add ability to reset statistics
Press 'r' in curses mode to reset a statistic counter to
start counting from 0 again. This does NOT reset the
counter from the source itself but merely emulates a
counter reset. If you restart bmon, the counter will be
back to its total value.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'include')
-rw-r--r-- | include/bmon/attr.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/bmon/attr.h b/include/bmon/attr.h index 224f151..9d52c78 100644 --- a/include/bmon/attr.h +++ b/include/bmon/attr.h @@ -42,6 +42,9 @@ struct rate /* Value of r_current at last read */ uint64_t r_prev; + /* Reset value to substract to emulate statistics reset */ + uint64_t r_reset; + /* Rate per second calculated every `rate_interval' */ float r_rate; @@ -49,6 +52,8 @@ struct rate timestamp_t r_last_calc; }; +extern uint64_t rate_get_total(struct rate *); + enum { ATTR_TYPE_UNSPEC, ATTR_TYPE_COUNTER, @@ -134,5 +139,6 @@ extern struct attr * attr_select_prev(void); extern struct attr * attr_current(void); extern void attr_start_collecting_history(struct attr *); +extern void attr_reset_counter(struct attr *a); #endif |