Re: Calculating cycles/byte

From: Mok-Kong Shen (mok-kong.shen_at_t-online.de)
Date: 07/29/03


Date: Tue, 29 Jul 2003 19:59:38 +0200


"J. Campbell" wrote:
>
> I've been toying with some hash-functions and wanted to know how
> people measure "cycles/byte". On my 1.5 GHz, win xp machine (on-line
> with several programs running), I can push an 18 MB zip file through
> my alg in about 0.1 sec. Back of envelope, I get ((1.5 bil cyc/sec) *
> (0.1 sec) / (18 mil bytes) = 8.3 cyc/byte.)
>
> Does anyone know how to accurately calculate the cyc/byte?

The same instruction may need different cycles for
different memebers of e.g. the Intel family. So I wonder
why do you want that quantity (since it can't be translated
to different hardware). If you do want that, you could use
the C standard function clock() to time the processing of
n bytes, with n sufficiently large in order to get a
significant value, say of the order of 100 sec. Then knowing
the MHz of your machine, I suppose you could get a reasonably
good result (though not 'very' accurate in my experience).
(I would prefer not to let concurrent user jobs be run during
the measurement, though I am not sure whether that's really
necessary.)

M. K. Shen



Relevant Pages

  • Re: Calculating cycles/byte
    ... > I've been toying with some hash-functions and wanted to know how ... > with several programs running), I can push an 18 MB zip file through ...
    (sci.crypt)
  • Calculating cycles/byte
    ... I've been toying with some hash-functions and wanted to know how ... people measure "cycles/byte". ... On my 1.5 GHz, win xp machine (on-line ... with several programs running), I can push an 18 MB zip file through ...
    (sci.crypt)