From Apple''s guide to improving code locality [1], it''s possible to get gprof to output an -- Ordering based on a ?closest is best? analysis of the profiling call graph. Calls that call each other frequently are placed close together. -- I''m having trouble with gprof on Mac OSX and I wonder how functions that call each other frequently can be tracked with DTrace. Any suggestions? There are also other orderings, e.g. - Routines sorted by the number of calls made to each routine, largest numbers first. - Routines sorted by the order in which they are called. - Routines sorted by the amount of CPU time spent, largest times first. but these are easy to take care of with DTrace. Thanks in advance, Joel [1] http://developer.apple.com/mac/library/documentation/Performance/Conceptual/CodeFootprint/Articles/ImprovingLocality.html#//apple_ref/doc/uid/20001862-103710 --- http://linkedin.com/in/joelreymont
David Collier-Brown
2009-Nov-27 22:04 UTC
[dtrace-discuss] improving code locality using dtrace
Joel Reymont <joelr1 at gmail.com> wrote:> From Apple''s guide to improving code locality [1], it''s possible to get gprof > to output an [...] Ordering based on a ?closest is best? analysis of the profiling > call graph. Calls that call each other frequently are placed close together.A classic example of using tis optimization was the Multics "binder", which took a list of functions or libraries and made a new library, optionally making particular entry points unreachable. It was used for performance work by grouping mutually referencing functions together, so the linkages didn''t require work by the runtime linker. Physical locality was a useful side-effect. It was also used to build what we''d now call a kind of subclassing, hiding the original class behind a new interface with the same signature. Similar to Solaris filter libraries. You could do the same thing with dtrace/prof data and a bit of selection on the inputs to the linker. --dave -- David Collier-Brown | Always do right. This will gratify Sun Microsystems, Toronto | some people and astonish the rest davecb at sun.com | -- Mark Twain cell: (647) 833-9377, home (416) 223-8968, bridge (877) 385-4099 code 506 9191#
On Nov 27, 2009, at 10:04 PM, David Collier-Brown wrote:> You could do the same thing with dtrace/prof data and a bit of > selection on the inputs to the linker.What''s what I''m trying to get to. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont