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>
This commit is contained in:
Thomas Graf
2016-01-29 12:11:44 +01:00
parent 1f79ea4396
commit 4efaa8ce9e
5 changed files with 40 additions and 6 deletions

View File

@ -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