Subject: Re: changing traffic counters to quad_t (long long)
To: Christoph Badura <>
From: Matt Thomas <>
List: tech-net
Date: 03/24/1998 13:23:56
At 10:13 AM 3/24/98 , Christoph Badura wrote:
> (Erik E. Fair  , Timekeeper) writes:
>>Has anyone ever proposed sticking #ifdef's around the metering code
>>to be able to turn it off for even more efficiency?
>I'd guess so.
>>Does one or more of the SNMP MIBs define some of these counters to
>>be only 32 bits?
>Uhm, by default *all* SNMP counters are 32 bits.

Not true.  On media faster than 20Mb/s, counters are required to be 

Rather than switching counters to 64-bit (except on 64-bit
platforms), it may be easier to keep counters as 32-bit shadows
and every-so often roll them into 64-bit counters.  (this can be
done by either zero'ing the 32-bit counters or keeping two 
shadow copies, alternating updates between them and rolling the
differences into 64-bit counters.

    ctr64->foo += (unsigned) (cur32->foo - last32->foo);

    memcpy(last32, cur32, sizeof(*cur32));

How fast you need to do the rollover can be computed using
if_baudrate.  This could even be done in if_watchdog so no driver
need be aware of it.
Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Nashua, NH                Disclaimer: I disavow all knowledge of this message