[MUD-Dev] Ticks?

Bruce Mitchener bruce at cubik.org
Thu Jun 13 22:54:52 CEST 2002


Eli Stevens wrote:

> One can use the ftime function to fill a timeb struct with the
> seconds and milliseconds since the epoch, along with the timezone
> and daylight savings time status.  This is wall clock time, not
> process time.  IIRC, clock() gives a higher resolution
> (microseconds, at least on my Linux box), but I am having a hard
> time picturing a situation where that kind of accuracy is really
> needed.

Eli,

Something where higher resolution clocks can be very useful is in
doing any sort of runtime profiling or process/thread accounting of
time spent.

And, should you get into that, the POSIX realtime services,
including clock_gettime() can be really useful if your OS supports
that API. (Linux with glibc 2.2 does.)

Then you can use CLOCK_PROCESS_CPUTIME_ID and
CLOCK_THREAD_CPUTIME_ID to track the CPU time spent per-process or
per-thread.

Enjoy,

  - Bruce

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list