Date: Wed, 28 Feb 1996 12:05:56 +0200 (IST) From: Eli Zaretskii To: Erik Luijten Cc: djgpp Subject: Re: time measurement in protected mode? In-Reply-To: <9602280849.AA20596@tntnhb3.tn.tudelft.nl> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 28 Feb 1996, Erik Luijten wrote: > I have written a program in which I have to keep track of the time spent > in various subroutines. On my workstation this works fine, but if I do this > in a DJGPP-compiled version on a PC, the timing routine considerably slows > down the program. I understand that this is caused by the switch from protected > to real mode. Is there any way to do a time measurement without this switch? > Or does it necessarily involve some BIOS function and hence a switch? 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. > A related question: at first I used biostime(), but this function restarts at > midnight. Now I'm using clock(), but I have no idea whether this function > will wrap around as well? If so, I wonder whether this occurs at the same time 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. > Finally (this may be a faq, but I couldn't find it): I really like the > go32=topline feature of v1. Is there something similar in v2, or is this > impossible because the DPMI host now takes care of many things? In that case, > would it be possible to include such a function is CWSDPMI? There is no such feature currently in DJGPP. Even it will be included, it will be only possible for CWSDPMI. Many people use other DPMI servers, where it is impossible at all.