@cryptotaxi247 / netdata-1 / commits / e87982b2b

switched to kernel_uint_t

Costa Tsaousis (ktsaou) committed Jan 29, 2017 at 17:17 UTC e87982b2be993fbc84540661869f0090633d54a3
1 file changed +59 -40
src/proc_net_dev.c
+59 -40
@@ -18,23 +18,23 @@ struct netdev {
18 int do_events;
19
20 // data collected
21 - unsigned long long rbytes;
22 - unsigned long long rpackets;
23 - unsigned long long rerrors;
24 - unsigned long long rdrops;
25 - unsigned long long rfifo;
26 - unsigned long long rframe;
27 - unsigned long long rcompressed;
28 - unsigned long long rmulticast;
29 -
30 - unsigned long long tbytes;
31 - unsigned long long tpackets;
32 - unsigned long long terrors;
33 - unsigned long long tdrops;
34 - unsigned long long tfifo;
35 - unsigned long long tcollisions;
36 - unsigned long long tcarrier;
37 - unsigned long long tcompressed;
21 + kernel_uint_t rbytes;
22 + kernel_uint_t rpackets;
23 + kernel_uint_t rerrors;
24 + kernel_uint_t rdrops;
25 + kernel_uint_t rfifo;
26 + kernel_uint_t rframe;
27 + kernel_uint_t rcompressed;
28 + kernel_uint_t rmulticast;
29 +
30 + kernel_uint_t tbytes;
31 + kernel_uint_t tpackets;
32 + kernel_uint_t terrors;
33 + kernel_uint_t tdrops;
34 + kernel_uint_t tfifo;
35 + kernel_uint_t tcollisions;
36 + kernel_uint_t tcarrier;
37 + kernel_uint_t tcompressed;
38
39 // charts
40 RRDSET *st_bandwidth;
@@ -167,35 +167,54 @@ int do_proc_net_dev(int update_every, usec_t dt) {
167 if(d->enabled == CONFIG_ONDEMAND_NO)
168 continue;
169
170 - d->do_bandwidth = config_get_boolean_ondemand(var_name, "bandwidth", do_bandwidth);
171 - d->do_packets = config_get_boolean_ondemand(var_name, "packets", do_packets);
172 - d->do_errors = config_get_boolean_ondemand(var_name, "errors", do_errors);
173 - d->do_drops = config_get_boolean_ondemand(var_name, "drops", do_drops);
174 - d->do_fifo = config_get_boolean_ondemand(var_name, "fifo", do_fifo);
170 + d->do_bandwidth = config_get_boolean_ondemand(var_name, "bandwidth", do_bandwidth);
171 + d->do_packets = config_get_boolean_ondemand(var_name, "packets", do_packets);
172 + d->do_errors = config_get_boolean_ondemand(var_name, "errors", do_errors);
173 + d->do_drops = config_get_boolean_ondemand(var_name, "drops", do_drops);
174 + d->do_fifo = config_get_boolean_ondemand(var_name, "fifo", do_fifo);
175 d->do_compressed = config_get_boolean_ondemand(var_name, "compressed", do_compressed);
176 - d->do_events = config_get_boolean_ondemand(var_name, "events", do_events);
176 + d->do_events = config_get_boolean_ondemand(var_name, "events", do_events);
177 }
178
179 if(unlikely(!d->enabled))
180 continue;
181
182 - d->rbytes = str2ull(procfile_lineword(ff, l, 1));
183 - d->rpackets = str2ull(procfile_lineword(ff, l, 2));
184 - d->rerrors = str2ull(procfile_lineword(ff, l, 3));
185 - d->rdrops = str2ull(procfile_lineword(ff, l, 4));
186 - d->rfifo = str2ull(procfile_lineword(ff, l, 5));
187 - d->rframe = str2ull(procfile_lineword(ff, l, 6));
188 - d->rcompressed = str2ull(procfile_lineword(ff, l, 7));
189 - d->rmulticast = str2ull(procfile_lineword(ff, l, 8));
190 -
191 - d->tbytes = str2ull(procfile_lineword(ff, l, 9));
192 - d->tpackets = str2ull(procfile_lineword(ff, l, 10));
193 - d->terrors = str2ull(procfile_lineword(ff, l, 11));
194 - d->tdrops = str2ull(procfile_lineword(ff, l, 12));
195 - d->tfifo = str2ull(procfile_lineword(ff, l, 13));
196 - d->tcollisions = str2ull(procfile_lineword(ff, l, 14));
197 - d->tcarrier = str2ull(procfile_lineword(ff, l, 15));
198 - d->tcompressed = str2ull(procfile_lineword(ff, l, 16));
182 + if(likely(d->do_bandwidth != CONFIG_ONDEMAND_NO)) {
183 + d->rbytes = str2kernel_unit_t(procfile_lineword(ff, l, 1));
184 + d->tbytes = str2kernel_unit_t(procfile_lineword(ff, l, 9));
185 + }
186 +
187 + if(likely(d->do_packets != CONFIG_ONDEMAND_NO)) {
188 + d->rpackets = str2kernel_unit_t(procfile_lineword(ff, l, 2));
189 + d->rmulticast = str2kernel_unit_t(procfile_lineword(ff, l, 8));
190 + d->tpackets = str2kernel_unit_t(procfile_lineword(ff, l, 10));
191 + }
192 +
193 + if(likely(d->do_errors != CONFIG_ONDEMAND_NO)) {
194 + d->rerrors = str2kernel_unit_t(procfile_lineword(ff, l, 3));
195 + d->terrors = str2kernel_unit_t(procfile_lineword(ff, l, 11));
196 + }
197 +
198 + if(likely(d->do_drops != CONFIG_ONDEMAND_NO)) {
199 + d->rdrops = str2kernel_unit_t(procfile_lineword(ff, l, 4));
200 + d->tdrops = str2kernel_unit_t(procfile_lineword(ff, l, 12));
201 + }
202 +
203 + if(likely(d->do_fifo != CONFIG_ONDEMAND_NO)) {
204 + d->rfifo = str2kernel_unit_t(procfile_lineword(ff, l, 5));
205 + d->tfifo = str2kernel_unit_t(procfile_lineword(ff, l, 13));
206 + }
207 +
208 + if(likely(d->do_compressed != CONFIG_ONDEMAND_NO)) {
209 + d->rcompressed = str2kernel_unit_t(procfile_lineword(ff, l, 7));
210 + d->tcompressed = str2kernel_unit_t(procfile_lineword(ff, l, 16));
211 + }
212 +
213 + if(likely(d->do_events != CONFIG_ONDEMAND_NO)) {
214 + d->rframe = str2kernel_unit_t(procfile_lineword(ff, l, 6));
215 + d->tcollisions = str2kernel_unit_t(procfile_lineword(ff, l, 14));
216 + d->tcarrier = str2kernel_unit_t(procfile_lineword(ff, l, 15));
217 + }
218
219 // --------------------------------------------------------------------
220