www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/10/19:24:05

From: cziwkga AT ulcc DOT ac DOT uk (Kevin Ashley)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: profiling under djgpp
Date: 10 Feb 1997 11:52:02 GMT
Organization: University of London Computer Centre
Lines: 46
Distribution: world
Message-ID: <5dn252$qqb@calypso.ulcc.ac.uk>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970121092143 DOT 26269O-100000 AT is>
Reply-To: k DOT ashley AT ulcc DOT ac DOT uk
NNTP-Posting-Host: silver-e.ulcc.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SUN DOT 3 DOT 91 DOT 970121092143 DOT 26269O-100000 AT is>, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:
|>On Mon, 20 Jan 1997, Leendert Combee wrote:
|>
|>>   From "man gprof" under SunOS/UNIX I quote:
|>> 
|>>      A single function may be split into subfunctions for profil-
|>>      ing by means of the MARK macro (see prof(3)).
|>
|>AFAIK, gcc doesn't support that functionality.  Could anybody who has gcc 
|>sources installed look and see for sure?  Thanks.
|>

A quick perusal of the sources I have leads me to believe that this
may work, but I must add the caveats that I am still running djgpp
1.12.m5 and I haven't actually tried this out. However, I believe
that the mechanism used depends on mcount and gprof only, and to some
extent on the behaviour of ld - specifically, whether it emits definitions
for defined but unreferenced global symbols to the final object file.

The macro would need to be recast in extended ASM format to prevent
the optimiser messing it up. This is its definition:

#ifndef MARK
#define MARK(K) {}
#else
#undef  MARK
#define MARK(K) {\
                asm("   .data"); \
                asm("   .align 4"); \
                asm("."#K".:"); \
                asm("   .long 0"); \
                asm("   .text"); \
                asm("M."#K":"); \
                asm("   movl    $."#K"., %edx"); \
                asm("   call _mcount"); \
                }
#endif
 
  

------------------------------------------------------------------------------
Kevin Ashley                              K DOT Ashley AT Ulcc DOT ac DOT uk
Development Manager              http://www.ulcc.ac.uk/staff/Kevin+Ashley
University of London Computer Centre.      ...ukc!ncdlab!K.Ashley
                      This is not a signature

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019