gak / pycallgraph

pycallgraph is a Python module that creates call graphs for Python programs.
GNU General Public License v2.0
1.83k stars 335 forks source link

Track call order #65

Closed gak closed 11 years ago

gak commented 15 years ago

It would be good to be able to see the order in which functions were called. This could get out of hand quite quickly, so maybe track only the first calls.

gak commented 15 years ago

Author: mage2k@gmail.com The file I just attached contains the diff that resulted from the additions to pycallgraph.py I made to add the display of call sequencing as numbered labels on the edges of the generated graphs. Multiple sequence numbers on the same edges are comma separated. I also added a new setting attribute to control whether or not to display the sequence numbers at all (it defaults to False). I hope you find this useful.

gak commented 15 years ago

Author: mage2k@gmail.com I'm sorry, I just realized that the display on the edges isn't working for multiple calls. Please, disregard (or, delete) that attachment. I'll work on getting this fixed tomorrow (it's late).

gak commented 15 years ago

Author: gak Replying to [comment:2 mage2k@gmail.com]:

I'm sorry, I just realized that the display on the edges isn't working for multiple calls. Please, disregard (or, delete) that attachment. I'll work on getting this fixed tomorrow (it's late).

No worries, attachment deleted.

gak commented 15 years ago

Author: mage2k@gmail.com Here's the fix. I hadn't quoted the label in the edge string.

gak commented 15 years ago

Author: mage2k@gmail.com Ok, now I'm getting Trac errors trying to post the fixed version. I've sent it to gak directly via email.

gak commented 15 years ago

Author: gak I've attached the new diff.

By the way, I found the uploading bug on Trac and it is fixed: http://trac.edgewall.org/ticket/4311

gak commented 15 years ago

Author: dreagonfly@gmx.de Hello, [[BR]] this is my try. Hopefully i do not miss something: [[BR]]

Instead of using the default dictionary I use a ordered dictionary (http://www.python.org/dev/peps/pep-0372/) from here http://www.xs4all.nl/~anthon/Python/ordereddict/ [[BR]] At the PEP-Site are pure python Modules (I dont test them but i expect they have the same behavior)

Additional it is necessary to add {{{ 'ordering' : 'out' }}} in the graph_attributes so that 'dot' saves the order how the graphs are defined. [[BR]] Now the children's of each node have the order when they are 'FIRST' called. Cheers, Stephan Hofmockel

gak commented 15 years ago

http://gist.github.com/166470