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

Comparing projects/libstatgrab/src/libstatgrab/network_stats.c (file contents):
Revision 1.44 by ats, Sat Feb 14 16:58:19 2004 UTC vs.
Revision 1.47 by tdb, Sat Mar 6 21:49:13 2004 UTC

# Line 77 | Line 77 | void network_stat_init(int start, int end, network_sta
77                  net_stats->interface_name=NULL;
78                  net_stats->tx=0;
79                  net_stats->rx=0;
80 +                net_stats->ipackets=0;
81 +                net_stats->opackets=0;
82 +                net_stats->ierrors=0;
83 +                net_stats->oerrors=0;
84 +                net_stats->collisions=0;
85                  net_stats++;
86          }
87   }
# Line 151 | Line 156 | network_stat_t *get_network_stats(int *entries){
156                  if(network_stat_ptr->interface_name==NULL) return NULL;
157                  net_data=(struct if_data *)net_ptr->ifa_data;
158                  network_stat_ptr->rx=net_data->ifi_ibytes;
159 <                network_stat_ptr->tx=net_data->ifi_obytes;                      
159 >                network_stat_ptr->tx=net_data->ifi_obytes;
160 >                network_stat_ptr->ipackets=net_data->ifi_ipackets;
161 >                network_stat_ptr->opackets=net_data->ifi_opackets;
162 >                network_stat_ptr->ierrors=net_data->ifi_ierrors;
163 >                network_stat_ptr->oerrors=net_data->ifi_oerrors;
164 >                network_stat_ptr->collisions=net_data->ifi_collisions;
165                  network_stat_ptr->systime=time(NULL);
166                  interfaces++;
167          }
# Line 262 | Line 272 | network_stat_t *get_network_stats(int *entries){
272   }
273  
274   long long transfer_diff(long long new, long long old){
275 < #if defined(SOL7) || defined(LINUX) || defined(FREEBSD)
275 > #if defined(SOL7) || defined(LINUX) || defined(FREEBSD) || defined(DFBSD)
276   #define MAXVAL 4294967296LL
277   #else
278   #define MAXVAL 18446744073709551616LL
# Line 306 | Line 316 | network_stat_t *get_network_stats_diff(int *entries) {
316                  dest->interface_name = strdup(src->interface_name);
317                  dest->rx = src->rx;
318                  dest->tx = src->tx;
319 +                dest->ipackets = src->ipackets;
320 +                dest->opackets = src->opackets;
321 +                dest->ierrors = src->ierrors;
322 +                dest->oerrors = src->oerrors;
323 +                dest->collisions = src->collisions;
324                  dest->systime = src->systime;
325          }
326  
# Line 336 | Line 351 | network_stat_t *get_network_stats_diff(int *entries) {
351                     difference. */
352                  dest->rx = transfer_diff(src->rx, dest->rx);
353                  dest->tx = transfer_diff(src->tx, dest->tx);
354 +                dest->ipackets = transfer_diff(src->ipackets, dest->ipackets);
355 +                dest->opackets = transfer_diff(src->opackets, dest->opackets);
356 +                dest->ierrors = transfer_diff(src->ierrors, dest->ierrors);
357 +                dest->oerrors = transfer_diff(src->oerrors, dest->oerrors);
358 +                dest->collisions = transfer_diff(src->collisions, dest->collisions);
359                  dest->systime = src->systime - dest->systime;
360          }
361  
# Line 477 | Line 497 | network_iface_stat_t *get_network_iface_stats(int *ent
497                          case(IFM_1000_SX):
498                          case(IFM_1000_LX):
499                          case(IFM_1000_CX):
500 < #if defined(FREEBSD) && !defined(FREEBSD5)
501 <                        case(IFM_1000_TX):
502 <                        case(IFM_1000_FX):
503 < #else
504 <                        case(IFM_1000_T):
500 > #ifdef IFM_1000_TX
501 >                        case(IFM_1000_TX): /* FreeBSD 4 and others? */
502 > #endif
503 > #ifdef IFM_1000_FX
504 >                        case(IFM_1000_FX): /* FreeBSD 4 */
505 > #endif
506 > #ifdef IFM_1000_T
507 >                        case(IFM_1000_T): /* FreeBSD 5 */
508   #endif
509                                  network_iface_stat_ptr->speed = 1000;
510                                  break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines