Use of MONITOR(3)

Tim Northrup tim at brspyr1.BRS.Com
Sat Sep 17 03:18:34 AEST 1988


I am trying to use the monitor(3) system call to restrict profiling to
a given set of routines, but it doesn't seem to be working.  Here is
the test case I have been trying.  Is there something I am doing
wrong here? [ this is on a Pyramid 90x, running OSx 3.1 ]

===========================================================================
	#define MB_Func	600		/* allow up to 600 routines */
	#define MB_Size 10240		/* give a good size buffer */
	short MonBuf[MB_Size];		/* where counts should go */

	int StartRoutine();		/* where to start monitoring */
	int AfterRoutine();		/* routine after 1 to stop in */

	main () {
					/* monitor selected routines */
		monitor(StartRoutine,AfterRoutine,MonBuf,MB_Size,MB_Func);

		StartRoutine();		/* call a monitored routine */

		monitor((int (*)())0,0,0,0,0);	/* terminate monitor */
		system("mv mon.out mon.save");	/* save output file */

		exit(0);
		}

	StartRoutine () { return(AnotherRoutine()); }
	AnotherRoutine () { return(0); }
	AfterRoutine () { return(0); }
===========================================================================

I compiled and linked this using:  "cc -p -o tfile tfile.c"

After running, I get a mon.save file, and a mon.out file, but prof(1)
cannot deal with either of them.  It gives a Floating Point Exception
and a core dump when run.  Inspecting the mon.* files shows that the
header looks correct (low-pc, high-pc and nfunc all appear to match
what I specified), but after that all values are 0.

Does anyone out there have any experience getting this beast to work?
Also, what makes a good value for the size of the buffer?  Any help
would be appreciated.

[ the actual module I want to use this on is VERY large, and doing a
  complete module profile does not work -- too many functions in it
  I suppose ]

Thanx in advance for any assistance.	-- Tim N.

-- 
Tim Northrup      		  +------------------------------------------+
+---------------------------------+         GEnie:  T.Northrup               |
UUCP: uunet!steinmetz!brspyr1!tim |   Air Warrior:  "Duke"                   |
ARPA: tim at brspyr1.BRS.Com	  +------------------------------------------+



More information about the Comp.unix.questions mailing list