udpate to profiling
Robert Collins
robert.collins@itdomain.com.au
Sun May 26 06:45:00 GMT 2002
This is a more comprehensive patch. It actually works properly under gdb.
Key notes:
1) cyggmon.dll has the gmon code to allow multiple dlls and the actual .exe to all share the all-important _gmonparam symbol.
2) The 100-odd Mb gmon.out is a side-effect of some apparent assumptions on the symbol table layout in memory. Win32's sparse layout really drives the current code hard for storage, and I've tried to find a happy medium. if you have a low-memory machine, I suggest pushing the constants in gmon.h up to 30 or 40 to get a smaller gmon.out.
3) To link a new program with libgmon.a, be sure to add -limagehlp to the link line. The gcc specs file can also be altered, of course.
4) gprof seems unable to find the symbols that are referenced in the gmon.out call-graph. I think it needs work to make it search the .dll's used by the profiled file, or perhaps to allow specifying multiple images on the command line. I make this assumption because only symbols present in the image are identified by gprof, as the appended output shows - the etext and <hicore> are dll call AFAICT.
Anyway, I don't have time to look into gprof.exe myself. I think that the -hard- part has been done, which was getting a clean-running gmon'd cygwin1.dll. There is one more hard thing to do with the profilable .dll, and that is fork() support, as the virtualAlloc'd ram isn't copied across AFAICT. That's alrigh, as atfork() should allow that to be addressed with a little care.
Anway, I'm putting this on hold until gprof is reviewed, whether by me or someone else.
Rob
G:\Users\RobertC\src\pthreadtest>gprof --file-info -l -p -q -b deadlock.exe dead
lock.out
File `deadlock.out' (version 0) contains:
1 histogram record
153 call-graph records
0 basic-block count records
♀
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 868 0.00 0.00 etext
0.00 0.00 0.00 1 0.00 0.00 __monstartup
0.00 0.00 0.00 1 0.00 0.00 _main
0.00 0.00 0.00 1 0.00 0.00 _t1
0.00 0.00 0.00 1 0.00 0.00 _t2
♀
Call graph
granularity: each sample hit covers 40 byte(s) no time propagated
index % time self children called name
0.00 0.00 1/868 t1 (deadlock.c:21 @ 4011b2) [91
]
0.00 0.00 1/868 t1 (deadlock.c:22 @ 4011d8) [92
]
0.00 0.00 1/868 t1 (deadlock.c:28 @ 40122d) [96
]
0.00 0.00 1/868 _t2 [117]
0.00 0.00 1/868 t2 (deadlock.c:38 @ 4012f6) [11
3]
0.00 0.00 1/868 t2 (deadlock.c:39 @ 401304) [11
2]
0.00 0.00 1/868 t2 (deadlock.c:44 @ 401345) [10
9]
0.00 0.00 1/868 t2 (deadlock.c:49 @ 401395) [10
5]
0.00 0.00 1/868 _main [115]
0.00 0.00 1/868 main (deadlock.c:60 @ 401500) [
30]
0.00 0.00 1/868 main (deadlock.c:62 @ 401528) [
26]
0.00 0.00 1/868 main (deadlock.c:65 @ 401548) [
33]
0.00 0.00 1/868 main (deadlock.c:72 @ 401590) [
38]
0.00 0.00 1/868 main (deadlock.c:77 @ 4015c0) [
41]
0.00 0.00 854/868 <hicore> (2)
[1] 0.0 0.00 0.00 868 etext [1]
-----------------------------------------------
0.00 0.00 1/1 <hicore> (2)
[114] 0.0 0.00 0.00 1 __monstartup [114]
-----------------------------------------------
0.00 0.00 1/1 <hicore> (2)
[115] 0.0 0.00 0.00 1 _main [115]
0.00 0.00 1/868 etext [1]
-----------------------------------------------
0.00 0.00 1/1 <hicore> (2)
[116] 0.0 0.00 0.00 1 _t1 [116]
-----------------------------------------------
0.00 0.00 1/1 <hicore> (2)
[117] 0.0 0.00 0.00 1 _t2 [117]
0.00 0.00 1/868 etext [1]
-----------------------------------------------
♀
Index by function name
[114] __monstartup [116] _t1 [1] etext
[115] _main [117] _t2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: profiling.diff
Type: application/octet-stream
Size: 30951 bytes
Desc: profiling.diff
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020526/77885d89/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: how-profiling-works.txt
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020526/77885d89/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmon.din
Type: application/octet-stream
Size: 84 bytes
Desc: gmon.din
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020526/77885d89/attachment-0001.obj>
More information about the Cygwin-patches
mailing list