lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> It is seems very useful, but still rely on clock() or
> times(). I can replace
> them with Win32 functions, but I still wonder what are the
> functions to
> profile an application (ie. to get its CPU time).


Are you sure clock() doesn't measure the CPU time on windows? I think it does.

Running a small test will check it out:

lua -e "s=clock() read() print(clock()-s)"

run this and, when you press enter, the time will show up. If clock() measures the CPU time given to the process, each run of this
program will give almost the same results (0 for sure), no matter how long you wait to press enter on each one.

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.