To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: gprof problems Date: Thu, 25 Aug 94 18:20:51 +0300 From: eliz AT is DOT elta DOT co DOT il A few problems I had recently working with gprof: 1. It seems that profiling doesn't work under DPMI, except counting the number of times each function was called. mcount_isr_init() (on crt0.s) explicitly tests for run_mode to be not more than 3, while DPMI is 4 (see include/go32.h). Is there some inherent incompatibility between DPMI and the timer tick interrupt, or is this just a bug? 2. Also, I would suggest to reprogram the timer to work with finer granularity than the default 55 msec. This would add only a few more machine instructions to the interrupt handler (to pass the interrupt down the chain only every n interrupts, so the system time runs at normal speed), but will greatly enhance the accuracy of the profile. 55 msec is really too coarse for most functions, and would skew the profile for programs which take a short time to execute. Another possibility is to use the CMOS clock which ticks every 1 msec, and can generate an interrupt if you ask nicely enough. This has an advantage of not messing up with the system timer. 3. It seems to me that the time spent outside the protected-mode code (including the library), e.g., when go32 does something on behalf of the user, doesn't get counted. For instance, a program which does lots of I/O doesn't get the time spent in I/O routines below the library listed. Is this really so? If it is, where is it implemented? I saw the skip_mcount flag in the timer handler, but didn't find anybody but mcount() itself setting that flag. Does go32 somehow sets it also? If so, where? And is this intentional? This might make sense under Unix environment, but for single-task DOS it effectively makes a very biased picture of where the does the program spend most of its time. 4. I also have noticed that some functions don't have a count of the number of times they were called listed in the profile. Two examples are findfirst and findnext. Why is that? Eli Zaretskii