| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 CygProfiler suite | 
|  | 2 ----------------- | 
|  | 3 | 
|  | 4 CygProfiler is a set of functions for use with gcc's | 
|  | 5 -finstrument-functions option. See info page of gcc for | 
|  | 6 details and description of this option. | 
|  | 7 | 
|  | 8 To use it, compile your program with -finstrument-functions | 
|  | 9 and link together with cyg-profile.c. Somewhere at the | 
|  | 10 beginning of the program call cygprofile_enable() to start | 
|  | 11 logging all function entries and exits into a logfile. | 
|  | 12 | 
|  | 13 By default the name of the logfile is cyglog.$PID, but you | 
|  | 14 can set a different one using cygprofile_setfilename(). | 
|  | 15 To get current logfile name use cygprofile_getfilename(). | 
|  | 16 To see if logging is enabled use cygprofile_isenabled(). | 
|  | 17 You can stop logging by calling cygprofile_disable(). | 
|  | 18 | 
|  | 19 Note that subsequent enabling of logging will overwrite the | 
|  | 20 previous log with the same name! | 
|  | 21 | 
|  | 22 After you have created a logfile run cyg-resolve.pl with the | 
|  | 23 program name that created the logfile as a first argument | 
|  | 24 and the logfile name as a second argument. On stdout you'll | 
|  | 25 see a log of all[1] functions invoked while logging was | 
|  | 26 enabled. | 
|  | 27 | 
|  | 28 Example for plain C: | 
|  | 29 $ gcc -finstrument-functions -o test test.c cyg-profile.c | 
|  | 30 $ ./test | 
|  | 31 Logfile: cyglog.1234 | 
|  | 32 $ cyg-progile.pl test cyglog.1234 | 
|  | 33 Loading symbols from test ... OK | 
|  | 34 Seen 65 symbols, stored 22 function offsets | 
|  | 35 Level correction set to 0 | 
|  | 36         +  0 0x80486a9 (from 0x804872f)  function3() | 
|  | 37         +  1 0x804866d (from 0x80486c8)   function2() | 
|  | 38         +  2 0x8048634 (from 0x804868c)    function1() | 
|  | 39 done | 
|  | 40 | 
|  | 41 As you can see - "function3()" called "function2()" which then | 
|  | 42 called "function1()". Function "main()" isn't in the list, | 
|  | 43 because the profiling was not yet enabled at the time it was | 
|  | 44 called. | 
|  | 45 | 
|  | 46 Example for C++: | 
|  | 47 $ gcc -c cyg-profile.c | 
|  | 48 $ g++ -finstrument-functions -c test.cxx | 
|  | 49 $ g++ -o test test.o cyg-profile.o | 
|  | 50 $ ./test | 
|  | 51 Logfile: cyglog.1234 | 
|  | 52 $ ./cyg-resolve.pl test cyglog.1234 | 
|  | 53 Loading symbols from test ... OK | 
|  | 54 Seen 78 symbols, stored 25 function offsets | 
|  | 55 Level correction set to 1 | 
|  | 56         +  1 0x400d1c (from 0x400dcb)   _ZN4test9function3Ec() | 
|  | 57         +  2 0x400cd4 (from 0x400d48)    _ZN4test9function2Ei() | 
|  | 58         +  3 0x400c98 (from 0x400d01)     _ZN4test9function1El() | 
|  | 59         +  0 0x400e3e (from 0x2a95ae2c8b)  __tcf_0() | 
|  | 60 done | 
|  | 61 | 
|  | 62 The usage is similar to the plain C case.  Unfortunately you'll | 
|  | 63 only see the mangled function names, e.g. "_ZN4test9function3Ec" | 
|  | 64 instead of "int test::function3(char c)". | 
|  | 65 | 
|  | 66 Michal Ludvig, <michal@logix.cz> | 
|  | 67 http://www.logix.cz/michal/devel | 
|  | 68 | 
|  | 69 ---- | 
|  | 70 [1] All means all functions, that were compiled with | 
|  | 71     -finstrument-functions. | 
| OLD | NEW | 
|---|