37 |
|
FLOAT, |
38 |
|
DOUBLE, |
39 |
|
STRING, |
40 |
< |
INT |
40 |
> |
INT, |
41 |
> |
DUPLEX |
42 |
|
} stat_type; |
43 |
|
|
44 |
|
typedef enum { |
349 |
|
void populate_net() { |
350 |
|
int n, i; |
351 |
|
network_stat_t *net; |
352 |
+ |
network_iface_stat_t *iface; |
353 |
|
|
354 |
|
net = use_diffs ? get_network_stats_diff(&n) : get_network_stats(&n); |
355 |
|
if (net != NULL) { |
366 |
|
"net", name, "systime", NULL); |
367 |
|
} |
368 |
|
} |
369 |
+ |
|
370 |
+ |
iface = get_network_iface_stats(&n); |
371 |
+ |
if (iface != NULL) { |
372 |
+ |
for (i = 0; i < n; i++) { |
373 |
+ |
const char *name = iface[i].interface_name; |
374 |
+ |
|
375 |
+ |
add_stat(INT, &iface[i].speed, |
376 |
+ |
"net", name, "speed", NULL); |
377 |
+ |
add_stat(DUPLEX, &iface[i].dup, |
378 |
+ |
"net", name, "duplex", NULL); |
379 |
+ |
} |
380 |
+ |
} |
381 |
|
} |
382 |
|
|
383 |
|
void populate_page() { |
473 |
|
break; |
474 |
|
case INT: |
475 |
|
printf("%d", *(int *)v); |
476 |
+ |
break; |
477 |
+ |
case DUPLEX: |
478 |
+ |
switch (*(duplex *) v) { |
479 |
+ |
case FULL_DUPLEX: |
480 |
+ |
printf("full"); |
481 |
+ |
break; |
482 |
+ |
case HALF_DUPLEX: |
483 |
+ |
printf("half"); |
484 |
+ |
break; |
485 |
+ |
default: |
486 |
+ |
printf("unknown"); |
487 |
+ |
break; |
488 |
+ |
} |
489 |
|
break; |
490 |
|
} |
491 |
|
} |