diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-25 10:44:14 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-25 10:44:14 +0300 |
commit | d8c782807ffbd0e7e30b07f88dd91b6dc0988219 (patch) | |
tree | 64cdbde6fc4f6ae6f3c2c0564cd1fc57d5de9088 /src/tagr.h | |
parent | cedb36dcc43d5cb89a0b4af0e7eeeddb02401595 (diff) | |
download | tagr-d8c782807ffbd0e7e30b07f88dd91b6dc0988219.tar.gz tagr-d8c782807ffbd0e7e30b07f88dd91b6dc0988219.tar.bz2 |
Normalize terminology.
* etc/upgrade.awk: Translate "router" to "monitor".
Divide max rate by 8.
* src/graph.c (rate_unit): New global.
(draw_graph): Take monitor as an argument. Make rate
units configurable.
* src/readconfig.c (find_router, find_router_id): Rename
to find_monitor, find_monitor_id.
Rename "router" section to "monitor".
New statement "rate-units", allowed both at top level and
within a monitor.
* src/tagr.h (HostData): Rename to monitor. Add new field: rate_unit.
Rename `max' to `max_rate'.
Remove t, in, out.
(rate_unit): New declaration.
(find_router, find_router_id): Rename
to find_monitor, find_monitor_id.
(struct last_sample): Rename to struct traffic_sample.
* src/output.c, src/report.c, src/stat.c: Update
Diffstat (limited to 'src/tagr.h')
-rw-r--r-- | src/tagr.h | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -30,16 +30,14 @@ #define _(s) s #define N_(s) s -typedef struct HostData +struct monitor { char *id; char *name; char *dir; - time_t t; - unsigned in; - unsigned out; - unsigned max; -} SD; + char *rate_unit; + unsigned max_rate; +}; extern struct grecs_sockaddr listen_sockaddr; extern int preprocess_only; @@ -57,6 +55,7 @@ extern char *html_template; extern char *html_input_file; extern int html_input_line; extern int verbose_level; +extern char *rate_unit; extern int percent_option; extern int transparent_option; @@ -80,8 +79,8 @@ void assign_string_n (char **pstr, const char *s, size_t length); int readconfig (void); void decode_buffer (); -SD *find_router (const char *name); -SD *find_router_id (const char *id); +struct monitor *find_monitor (const char *name); +struct monitor *find_monitor_id (const char *id); void begin_eval (); void end_eval (); @@ -160,7 +159,7 @@ struct stat_queue struct traffic_history *queue; }; -struct last_sample +struct traffic_sample { time_t time; unsigned long in, out; @@ -176,7 +175,7 @@ struct avg_acc struct traffic_record { - struct last_sample last; /* Lastly taken sample */ + struct traffic_sample last; /* Lastly taken sample */ struct traffic_history last_rates; /* Average accumulators */ struct avg_acc week_avg; @@ -194,9 +193,10 @@ struct traffic_record void open_db (); void close_db (); -void read_db (SD *sd, struct traffic_record **tr); -void write_db (SD *sd, struct traffic_record *tr); -void update_stats (SD *sd, struct traffic_record *tr); +void read_db (struct monitor *mon, struct traffic_record **tr); +void write_db (struct monitor *mon, struct traffic_record *tr); +void update_stats (struct monitor *mon, struct traffic_sample *sample, + struct traffic_record *tr); void rebuild (void); void import (const char *dir); @@ -212,8 +212,8 @@ char *mkfilename (char *dir, char *name, char *suffix); /* output.c */ -int update_output (SD *host, struct traffic_record *tr, time_t timestamp, - int force); +int update_output (struct monitor *mon, struct traffic_record *tr, + time_t timestamp, int force); /* graph.c */ @@ -238,7 +238,8 @@ extern struct grid_class grid_class_x_week; extern struct grid_class grid_class_x_month; int draw_graph (FILE *fp, + struct monitor *mon, queue_t *dataq, const struct avg_acc *avg, time_t now, - int xstep, unsigned long xmax, unsigned long ymax, + int xstep, unsigned long xmax, int growright, struct grid_class *xgrid, struct grid_class *ygrid); |