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.54 by tdb, Mon Mar 8 13:48:00 2004 UTC vs.
Revision 1.56 by ats, Tue Mar 9 12:43:41 2004 UTC

# Line 199 | Line 199 | network_stat_t *get_network_stats(int *entries){
199                                   * have the rbytes/obytes values; for instance,
200                                   * the loopback devices have this behaviour
201                                   * (although they do track packets in/out). */
202 +                                /* FIXME: Show packet counts when byte counts
203 +                                 * not available. */
204                                  continue;
205                          }
206  
# Line 320 | Line 322 | network_stat_t *get_network_stats(int *entries){
322   }
323  
324   long long transfer_diff(long long new, long long old){
325 < #if defined(SOL7) || defined(LINUX) || defined(FREEBSD) || defined(DFBSD)
326 < #define MAXVAL 0xffffffffLL
325 > #if defined(SOL7) || defined(LINUX) || defined(FREEBSD) || defined(DFBSD) || defined(OPENBSD)
326 >        /* 32-bit quantities, so we must explicitly deal with wraparound. */
327 > #define MAXVAL 0x100000000LL
328 >        if (new >= old) {
329 >                return new - old;
330 >        } else {
331 >                return MAXVAL + new - old;
332 >        }
333   #else
334 < #define MAXVAL 0xffffffffffffffffLL
334 >        /* 64-bit quantities, so plain subtraction works. */
335 >        return new - old;
336   #endif
328        long long result;
329        if(new>=old){
330                result = (new-old);
331        }else{
332                result = (MAXVAL+(new-old));
333        }
334
335        return result;
336
337   }
338  
339   network_stat_t *get_network_stats_diff(int *entries) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines