Date: Wed, 28 Feb 1996 12:52:58 +0100 (MET) From: erik AT tntnhb3 DOT tn DOT tudelft DOT nl (Erik Luijten) Subject: Re: time measurement in protected mode? In-reply-to: To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) Cc: djgpp AT delorie DOT com (djgpp) Message-id: <9602281152.AA20955@tntnhb3.tn.tudelft.nl> Content-type: text Content-transfer-encoding: 7BIT Eli Zaretskii wrote: > > You'll have to provide more details to get meaningful answers to your > question. If you only want to time various functions, you can simply > compile it with -pg switch and use `gprof' to generate a report after > the program exits. If this is a feature that you must use while the > program runs, please tell to what accuracy do you need to measure time. Thank you for your answer. I do know about profiling, but now it must be a feature of the program. The accuracy does not have be too high: one second would be ok, 0.01 second would be perfect. > It is enough to time for 24 hours without wrapping around (but it measures > relative to the time the program started, so it will wrap about 24 hours > after the program started, not at midnight). For larger time periods > (really, for anything that lasts as long as a few hours), you should use > the `gettimeofday' library function. Why do you say: for anything as long as a few hours, if clock() only wraps after ca. 24 hours? gettimeofday() seems ok, but doesn't it require a switch to real mode? If so, is there any other timer function (resolution see above) which does not require this switch? Erik