Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* more profiling questions...
@ 1996-05-03 12:02 Harald Koenig
  0 siblings, 0 replies; only message in thread
From: Harald Koenig @ 1996-05-03 12:02 UTC (permalink / raw)


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                     ^^^^^       ^^^^^

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-05-03 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-05-03 12:02 more profiling questions Harald Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox