diff options
Diffstat (limited to 'src/output.c')
-rw-r--r-- | src/output.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/output.c b/src/output.c index e2e8b92..3c266b7 100644 --- a/src/output.c +++ b/src/output.c | |||
@@ -114,29 +114,30 @@ add_stats (pp_tab_t **ptab, struct monitor *mon, queue_t *q, | |||
114 | int i, n = queue_count (q); | 114 | int i, n = queue_count (q); |
115 | struct traffic_history *tptr, th; | 115 | struct traffic_history *tptr, th; |
116 | 116 | ||
117 | if (!n) | 117 | if (n) |
118 | return; | ||
119 | for (i = 0; i < n; i++) | ||
120 | { | 118 | { |
121 | tptr = queue_get_ptr (q, i); | 119 | for (i = 0; i < n; i++) |
122 | scale_sample (mon, tptr, &th); | 120 | { |
121 | tptr = queue_get_ptr (q, i); | ||
122 | scale_sample (mon, tptr, &th); | ||
123 | |||
124 | val[avgin_name] += th.inrate; | ||
125 | if (th.inrate > val[maxin_name]) | ||
126 | val[maxin_name] = th.inrate; | ||
127 | |||
128 | val[avgout_name] += th.outrate; | ||
129 | if (th.outrate > val[maxout_name]) | ||
130 | val[maxout_name] = th.outrate; | ||
131 | } | ||
132 | val[avgin_name] /= n; | ||
133 | val[avgout_name] /= n; | ||
123 | 134 | ||
124 | val[avgin_name] += th.inrate; | 135 | tptr = queue_get_tail (q); |
125 | if (th.inrate > val[maxin_name]) | 136 | scale_sample (mon, tptr, &th); |
126 | val[maxin_name] = th.inrate; | 137 | val[curin_name] = th.inrate; |
127 | 138 | val[curout_name] = th.outrate; | |
128 | val[avgout_name] += th.outrate; | ||
129 | if (th.outrate > val[maxout_name]) | ||
130 | val[maxout_name] = th.outrate; | ||
131 | } | 139 | } |
132 | val[avgin_name] /= n; | 140 | |
133 | val[avgout_name] /= n; | ||
134 | |||
135 | tptr = queue_get_tail (q); | ||
136 | scale_sample (mon, tptr, &th); | ||
137 | val[curin_name] = th.inrate; | ||
138 | val[curout_name] = th.outrate; | ||
139 | |||
140 | for (i = 0; i < sizeof (val) / sizeof (val[0]); i++) | 141 | for (i = 0; i < sizeof (val) / sizeof (val[0]); i++) |
141 | add_numeric_value (ptab, symname[i], val[i]); | 142 | add_numeric_value (ptab, symname[i], val[i]); |
142 | } | 143 | } |