ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/statgrab/statgrab.c
(Generate patch)

Comparing projects/libstatgrab/src/statgrab/statgrab.c (file contents):
Revision 1.15 by ats, Mon Jan 5 17:20:30 2004 UTC vs.
Revision 1.19 by ats, Fri Feb 13 15:13:37 2004 UTC

# Line 1 | Line 1
1   /*
2   * i-scream central monitoring system
3   * http://www.i-scream.org
4 < * Copyright (C) 2000-2003 i-scream
4 > * Copyright (C) 2000-2004 i-scream
5   *
6   * This program is free software; you can redistribute it and/or
7   * modify it under the terms of the GNU General Public License
# Line 16 | Line 16
16   * You should have received a copy of the GNU General Public License
17   * along with this program; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + *
20 + * $Id$
21   */
22  
23   #ifdef HAVE_CONFIG_H
# Line 35 | Line 37 | typedef enum {
37          FLOAT,
38          DOUBLE,
39          STRING,
40 <        INT
40 >        INT,
41 >        DUPLEX
42   } stat_type;
43  
44   typedef enum {
# Line 346 | Line 349 | void populate_proc() {
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) {
# Line 362 | Line 366 | void populate_net() {
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() {
# Line 457 | Line 473 | void print_stat_value(const stat *s) {
473                  break;
474          case INT:
475                  printf("%d", *(int *)v);
476 +                break;
477 +        case DUPLEX:
478 +                switch (*(statgrab_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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines