Path: utzoo!attcan!uunet!mcvax!eurtrx!euraiv1!evas
From: evas@euraiv1.UUCP (Eelco van Asperen)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Turbo C Debugger (really: profiling under DOS vs. Unix)
Summary: Compiler support for profiling wanted
Message-ID: <715@euraiv1.UUCP>
Date: 9 Jul 88 16:11:57 GMT
References: <11590@agate.BERKELEY.EDU> <1803@akgua.ATT.COM> <12338@mimsy.UUCP>
Organization: Erasmus University EF/AIV,Rotterdam,Netherlands
Lines: 54

in article <12338@mimsy.UUCP>, jds@mimsy.UUCP (James da Silva) says:
> Actually, Brian, a DOS Compiler has the potential to blow away any Unix-based
> compiler in the area of profiling; DOS's main weakness is a strength when it
> comes to profiling.
...
> Unfortunately, I have yet to see a compiler that takes full advantage of
> the PC's clock chip to construct a really great profiler.
 
Yeah, and it's so easy to create a few routines to manipulate the clock 
chip and do profiling. I've created a small package based on the Unix 'cb'
program to modify C source-code; at the start and end of each function,
function-calls are made to signal entry and leave of the function. This 
is not perfect of course; if the 'return'-statement of a function contains
stuff that takes a lot of time, that time is not added to the function's
running time but to it's caller.
Here's what a small function would look like after modification;

	int small(int hello)
	{
		int PROFdummy_var = PROFstart();
		int alfa;

		....
		if (alfa) {
			PROFend();
			return hello;
		}

		{
		PROFend();
		return -1;
		}
	}

The 'int PROFdummy_var =' statement is used to include the time spent
in initialization.
I run the clock at 4659 ticks per second, ie. 18.2 * 256 Hz.

Unfortunately, I can't distribute the code because it is a hacked version
of 'cb' and runs on a Unix box here (yes, we have a real AT&T source
license).

How about it, Borland, Microsoft ? Give us either built-in profiling
or the option to call special functions on entry & leave of functions.

Eelco van Asperen.

----------------------------
uucp:            evas@eurtrx
  or:      mcvax!eurtrx!evas
earn/bitnet: asperen@hroeur5
----------------------------
#include 
#include