Date: Mon, 14 Jan 2002 13:07:05 -0700 (MST) From: "M. Warner Losh" <imp@village.org> To: bmilekic@technokratis.com Cc: arch@FreeBSD.ORG Subject: Re: 64 bit counters again Message-ID: <20020114.130705.84407599.imp@village.org> In-Reply-To: <20020114114911.A24990@technokratis.com> References: <20020114105859.A24635@technokratis.com> <3C4305E5.65BB32A6@FreeBSD.org> <20020114114911.A24990@technokratis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20020114114911.A24990@technokratis.com>
Bosko Milekic <bmilekic@technokratis.com> writes:
: You're going to run into the same problem with a 64-bit counter, as
: Terry pointed out. You're just going to end up moving the time it
: takes from 172 seconds to some other, slightly longer, although equally
: unreasonable, time.
A 64-bit qauntity would take 738734374912 seconds to overflow if the
32-bit one overflowed in 172 seconds. That strikes me as a reasonable
enough period of time. If I did the math right, that's on the order
of 23 millinia (23425 years).
: Instead of counting bytes, perhaps you should count
: K or M Bytes. Just take the delta you're about to add to your counter
: and divide it by something reasonable before adding it. If you are
: really bent on getting accurate results, maintain a separate counter
: and sum remainders in it. I'm sure you'll get slightly more accurate
: data while not changing all counters to be 64-bits wide on non-64 bit
: platforms (i.e., you'll keep the added execution time local to that
: specific code you're working on).
That's a whole lot more hair than a 64-bit counter :-). Maybe you
could do it in k bytes, but the typical packet size is on the order of
1.5k, so you have an error in the neighborhood of 50%. This would be
0M always. It seems to be that the atomicacy of the updates for any
accumlated remainder scheme would be the same as for a 64-bit counter,
and a whole lot more hair.
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020114.130705.84407599.imp>
