Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!cernvax!chx400!ethz!forty2!mecazh!paul From: paul@mecazh.UUCP (Paul Breslaw) Newsgroups: comp.sys.hp Subject: Problems with prof(1) and gprof(1) Keywords: profile, monitor, core dump Message-ID: <364@node17.mecazh.UUCP> Date: 16 Oct 89 12:34:07 GMT Organization: Mecasoft SA, Zurich, Switzerland Lines: 63 I have tried profiling a number of C and Pascal programs with prof(1) and gprof(1) under HP-UX6.5 on a 9000/340. A simple example follows. The purpose of the meaningless loop in foo_proc is to consume time so that profile(2) gets a look in. /******************************/ /* foo.c */ #include #include #include #define MONBUFSZ 65536 extern etext; WORD monbuf[ MONBUFSZ ]; void foo_proc(); main() { int i; monitor( (int (*)()) 2, (int (*)()) &etext, monbuf, MONBUFSZ, 20 ); for (i = 0; i < 10; i++) foo_proc(); monitor( (int (*)()) 0, (int (*)()) 0, 0, 0, 0 ); exit( 0 ); } void foo_proc() { int i, j; for (i = 0; i < 100000; i++) j = i; } /********************************************/ For prof, I compile as:- cc -p -o foo foo.c For gprof:- cc -G -o foo foo.c Then both prof foo and gprof foo crash with a Floating exception. What am I (or someone else) doing wrong? -- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Paul Breslaw, Mecasoft SA, | telephone : 41 1 362 2040 Guggachstrasse 10, CH-8057 Zurich, | e-mail : mcvax!cernvax!mecazh!paul Switzerland. |