[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: clock() function note ...
- From: Reuben Thomas <rrt@...>
- Date: Tue, 11 Jun 2002 10:55:31 +0100 (BST)
> > this way, HD access (or floppy or a socket) that you mentioned some emails
> ago won't count to clock(), so you don't need to "reset
> > the filesystem chache" of your machine.
> I am not sure to agree with you here.
> Say I read a file line by line. The first time I run this program, Windows
> will read the file on the disk. I think this file will be on a cache (but I am
> not a specialist here). So on the second run, Windows will indeed read the
> file from memory, much faster.
> When I do a recursive search, say with Visual Studio, on a lot of sources,
> it is quite slow the first time, and very fast the next pass.
The point is that if you measure only the time taken by the process in
user mode (on Unix) then the disk accesses which slow you down the first
time won't be counted (because they will be part of the kernel mode time
taken by the process).
Of course whether this is what clock () does, especially on non UNIX OSes,
is entirely another matter.
http://www.mupsych.org/rrt/ | Careful Cyclists Approaching From Right