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: 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 , Eli Zaretskii 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