From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <11b53cada439c78e17912f76dcaac069.axp-list@archive.invalid> X-Archive-Original-Message-ID: <9605031156.AA16729@nova.tat.physik.uni-tuebingen.de> Date: Fri, 3 May 1996 14:02:48 +0200 (MET DST) From: Harald Koenig Subject: more profiling questions... since gprog didn't work that well I tried to do some program counter profiling using profil() which showed other problems in libc-linux-0.40.2/sysdeps/linux/alpha/gmon/profil.c without debug and non-alpha code: ------------------------------------------------------------------------------- static void _profil_handler(long signr, long code, struct sigcontext_struct *scp) { unsigned long pc, spot; unsigned long *ptr; ptr=(&scp)+2; scp=ptr; pc = scp->sc_pc - prof_offset; spot = (((prof_scale*(pc >> 16))&0xffff) + ((prof_scale*(pc & (0x10000 - 1))) >> 16)) & ~1; if (spot < prof_bufsiz) ++*((unsigned short *) (spot + prof_buf)); } ------------------------------------------------------------------------------- what's the reason for the ptr=(&scp)+2; scp=ptr; statements? *without* this two lines I get the correct PC in scp->sc_pc. and what's the reason for this spot function ? why isn't the user allowed to get any finer resolution than 64k ? looking into the profiling code I've looked for the alignment trap for gprof startup code in monstartup (libc-linux-0.40.2/sysdeps/linux/alpha/gmon/gmon.c) which looks like this: ------------------------------------------------------------------------------- buffer = (void *) sbrk( monsize ); [ ... ] sbuf = buffer; ssiz = monsize; ( (struct phdr *) buffer ) -> lpc = lowpc; /* ALIGNMENT TRAP ! */ ( (struct phdr *) buffer ) -> hpc = highpc; /* ALIGNMENT TRAP ! */ ( (struct phdr *) buffer ) -> ncnt = ssiz; ------------------------------------------------------------------------------- the alignment trap occur on the assignment of lpc and hpc which are 64bit because for some reason sbrk() returns a 32bit-aligned value to "buffer". I've tried to get any non-8-byte aligned address from sbrk() with no success. could this be an sbrk() problem ?? Harald -- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^