[Home] [Groups] - Message: [Prev in Group] [Next in Group]
22961: Re: [MUD-Dev] Ticks?
[Full Header] [Plain Text]
From: Bruce Mitchener <bruce@cubik.org>
Newsgroups: nu.kanga.list.mud-dev
Date: Thu, 13 Jun 2002 22:54:52 -0600
References: [1] [2] [3] <-newest
Organization: Kanga.Nu
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@kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev