Coder Social home page Coder Social logo

pycallgraph's Issues

Track call order

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.

Speed up trace by a lot

If you replace all sys.settrace(tracer) calls with sys.setprofile(tracer) and ignore the first return event in the tracer. Running a script will be dramatically faster.

(setprofile only logs call and return events, where settrace will also call the tracer function for each line that is interpreted)

You might also want to react on c_call and c_return events (logging extension modules)

pycallgraph as a script

It would be useful to be able to use pycallgraph from the command line:

{{{
$ pycallgraph --include='genshi*' --output=test.png test.py
}}}

execfile() is the love you want:

{{{

!python

!/usr/bin/env python

import sys
import pycallgraph

pycallgraph.start_trace(filter=pycallgraph.GlobbingFilter(include=['genshi*']))
execfile(sys.argv[1])
pycallgraph.make_dot_graph('test.png')
}}}

Subsequent calls to start_trace(reset=False) loses __main__

It seems calls to start_trace(reset=False) loses edges from main for all but the first start_trace, i.e. the first one after a reset_trace(). It seems maybe there is something that needs "resetting" even when not resetting?

Simple example:

        pycallgraph.start_trace(reset=False)
        #pycallgraph.stop_trace()
        pycallgraph.start_trace(reset=False)
        ...test code here...
        pycallgraph.stop_trace()

That works normally, now uncomment the stop_trace() command, and rerun... main disappears.

Wrong doc on front page

On front page (http://pycallgraph.slowchop.com/) in section Usage you have
pycallgraph.make_call_graph('test.png')
and
pycallgraph.make_call_graph('test.jpg', format='jpg', tool='neato')

But this functions do not exist in pycallgraph-0.3.0. It take me several minutes before I realized that the function is named make_dot_graph.

Miroslav Suchy

Offline Filtering...

Especially with code that takes a long time to execute (especially after the settrace call...) I would like to collect all calls for later offline investigation. I would suggest a save_graph and a load_graph? I can then save_graph (instead of save_dot, e.g.), then at a later time, load_graph, followed by save_dot (or make_dot_graph). That is the first step, the second is to allow filtering of this already-collected graph, so I can run the trace once, then generate graphs for various modules independently.

This might get clunky if one just adds bits and pieces, a slight redesign might be sensible?

Is there any performance reasons to have filters where they currently are? If we add "offline filters", there'd be two different places to filter. I might propose removing the online filters? (Or keeping them for legacy/support, though, how many users does pycallgraph currently have?)

http://thinktoomuch.net/2007/06/06/python-call-graphs/

Track call order

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.

Retrieving edge pairs

It would be great to be able to get the edges of the callgraph so that they can be processed with other tools. I've added the following function:
{{{
def get_calltree(stop=True):
"""Compiles the edges for the graph."""

edges = list()

if stop:
    stop_trace()


for fr_key, fr_val in call_dict.items():
    if fr_key == '':
        continue

    for to_key, to_val in fr_val.items():

        edges.append((fr_key, to_key))

return edges

}}}

It would be great to have this functionality on pycallgraph, maybe expanded so that the node names include the call count and other statistics.

Incorrect class names used when calling base class methods

When calling methods on objects that were defined in a superclass, the child class is used for the node's class_name rather than the class where the method was defined.

Example:
{{{
class A(object):
def init(self):
pass

class B(A):
def init(self):
A(self)
}}}
Will result in two nodes, both with class B rather than one of each. I've attached a patch to fix this

Offline Filtering...

Especially with code that takes a long time to execute (especially after the settrace call...) I would like to collect all calls for later offline investigation. I would suggest a save_graph and a load_graph? I can then save_graph (instead of save_dot, e.g.), then at a later time, load_graph, followed by save_dot (or make_dot_graph). That is the first step, the second is to allow filtering of this already-collected graph, so I can run the trace once, then generate graphs for various modules independently.

This might get clunky if one just adds bits and pieces, a slight redesign might be sensible?

Is there any performance reasons to have filters where they currently are? If we add "offline filters", there'd be two different places to filter. I might propose removing the online filters? (Or keeping them for legacy/support, though, how many users does pycallgraph currently have?)

http://thinktoomuch.net/2007/06/06/python-call-graphs/

Allow command line options to called scripts

I was amazed at how simple it was to install and use pycallgraph. Just one suggestion.

It would be very helpful if you could specify sys.argv to the called script on the command line. That way I wouldn't have to make a new script file for every set of options. If you put the output filename before the scriptfile you could feed the rest of the command line to the called script. For example:

{{{
pycallgraph-dot.py test1.png myscript.py --spam=42 ham.txt eggs.txt
}}}

error code 32512

i have tried to run the basic example but i get the following error:

'The command "dot -Tpng -obasic.png /tmp/tmp_Imspl" failed with error code 32512.'

i work on osx 10.4.10

Offline Filtering...

Especially with code that takes a long time to execute (especially after the settrace call...) I would like to collect all calls for later offline investigation. I would suggest a save_graph and a load_graph? I can then save_graph (instead of save_dot, e.g.), then at a later time, load_graph, followed by save_dot (or make_dot_graph). That is the first step, the second is to allow filtering of this already-collected graph, so I can run the trace once, then generate graphs for various modules independently.

This might get clunky if one just adds bits and pieces, a slight redesign might be sensible?

Is there any performance reasons to have filters where they currently are? If we add "offline filters", there'd be two different places to filter. I might propose removing the online filters? (Or keeping them for legacy/support, though, how many users does pycallgraph currently have?)

http://thinktoomuch.net/2007/06/06/python-call-graphs/

Wrong doc on front page

On front page (http://pycallgraph.slowchop.com/) in section Usage you have
pycallgraph.make_call_graph('test.png')
and
pycallgraph.make_call_graph('test.jpg', format='jpg', tool='neato')

But this functions do not exist in pycallgraph-0.3.0. It take me several minutes before I realized that the function is named make_dot_graph.

Miroslav Suchy

add filtering to time measurements

{{{
05:02:26 that timing shit is cool :)
05:02:33 however, i have one slight problem
05:03:06 the top-level function gets all the accumulated time of its children, which is fair enough
05:03:24 but it'd be nice to be able to exclude them from the colouring...somehow
05:03:38 have u tried the exclude filtering?
05:03:43 yeah
05:03:53 but that breaks the graph up so much it ends up at around 30K horizontal pixels
05:03:56 too many subgraphs
05:03:58 hmm
05:04:07 tricky :
05:04:16 --exclude-colouring
05:04:35 yeah that would wfm
05:04:54 or.. --excluding-timing
05:04:57 yeah!
05:05:01 that would be better i think
05:05:09 ill ticket it
05:05:12 oarsome
}}}

error code 32512

i have tried to run the basic example but i get the following error:

'The command "dot -Tpng -obasic.png /tmp/tmp_Imspl" failed with error code 32512.'

i work on osx 10.4.10

pycallgraph man page

Hi

Attached is a pycallgraph-dot manpage I create for the Debian package. Let me you know any comments you might have.

Cheers!

Track call order

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.

Retrieving edge pairs

It would be great to be able to get the edges of the callgraph so that they can be processed with other tools. I've added the following function:
{{{
def get_calltree(stop=True):
"""Compiles the edges for the graph."""

edges = list()

if stop:
    stop_trace()


for fr_key, fr_val in call_dict.items():
    if fr_key == '':
        continue

    for to_key, to_val in fr_val.items():

        edges.append((fr_key, to_key))

return edges

}}}

It would be great to have this functionality on pycallgraph, maybe expanded so that the node names include the call count and other statistics.

pycallgraph as a script

It would be useful to be able to use pycallgraph from the command line:

{{{
$ pycallgraph --include='genshi*' --output=test.png test.py
}}}

execfile() is the love you want:

{{{

!python

!/usr/bin/env python

import sys
import pycallgraph

pycallgraph.start_trace(filter=pycallgraph.GlobbingFilter(include=['genshi*']))
execfile(sys.argv[1])
pycallgraph.make_dot_graph('test.png')
}}}

Subsequent calls to start_trace(reset=False) loses __main__

It seems calls to start_trace(reset=False) loses edges from main for all but the first start_trace, i.e. the first one after a reset_trace(). It seems maybe there is something that needs "resetting" even when not resetting?

Simple example:

        pycallgraph.start_trace(reset=False)
        #pycallgraph.stop_trace()
        pycallgraph.start_trace(reset=False)
        ...test code here...
        pycallgraph.stop_trace()

That works normally, now uncomment the stop_trace() command, and rerun... main disappears.

Track call order

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.

Incorrect class names used when calling base class methods

When calling methods on objects that were defined in a superclass, the child class is used for the node's class_name rather than the class where the method was defined.

Example:
{{{
class A(object):
def init(self):
pass

class B(A):
def init(self):
A(self)
}}}
Will result in two nodes, both with class B rather than one of each. I've attached a patch to fix this

Subsequent calls to start_trace(reset=False) loses __main__

It seems calls to start_trace(reset=False) loses edges from main for all but the first start_trace, i.e. the first one after a reset_trace(). It seems maybe there is something that needs "resetting" even when not resetting?

Simple example:

        pycallgraph.start_trace(reset=False)
        #pycallgraph.stop_trace()
        pycallgraph.start_trace(reset=False)
        ...test code here...
        pycallgraph.stop_trace()

That works normally, now uncomment the stop_trace() command, and rerun... main disappears.

add filtering to time measurements

{{{
05:02:26 that timing shit is cool :)
05:02:33 however, i have one slight problem
05:03:06 the top-level function gets all the accumulated time of its children, which is fair enough
05:03:24 but it'd be nice to be able to exclude them from the colouring...somehow
05:03:38 have u tried the exclude filtering?
05:03:43 yeah
05:03:53 but that breaks the graph up so much it ends up at around 30K horizontal pixels
05:03:56 too many subgraphs
05:03:58 hmm
05:04:07 tricky :
05:04:16 --exclude-colouring
05:04:35 yeah that would wfm
05:04:54 or.. --excluding-timing
05:04:57 yeah!
05:05:01 that would be better i think
05:05:09 ill ticket it
05:05:12 oarsome
}}}

Allow command line options to called scripts

I was amazed at how simple it was to install and use pycallgraph. Just one suggestion.

It would be very helpful if you could specify sys.argv to the called script on the command line. That way I wouldn't have to make a new script file for every set of options. If you put the output filename before the scriptfile you could feed the rest of the command line to the called script. For example:

{{{
pycallgraph-dot.py test1.png myscript.py --spam=42 ham.txt eggs.txt
}}}

exit with error while creating graph

Using the module on windows with python 2.5 I get the following error:

Der Befehl "dot" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
{{{
Traceback (most recent call last):
File "simple-coordinate-converter_graph.py", line 132, in
pycallgraph.make_dot_graph('D:\development\python\scripts\coordinate-convert
er\test.png')
File "C:\python\lib\site-packages\pycallgraph.py", line 378, in make_dot_graph

'code %(ret)i.' % locals())

pycallgraph.PyCallGraphException: The command "dot -Tpng -oD:\myscript est.png c:\dokume1\USERNAME\lokale1\temp\tmpu4jgj
j" failed with error code 1.
}}}
Drücken Sie eine beliebige Taste . . .

Wrong doc on front page

On front page (http://pycallgraph.slowchop.com/) in section Usage you have
pycallgraph.make_call_graph('test.png')
and
pycallgraph.make_call_graph('test.jpg', format='jpg', tool='neato')

But this functions do not exist in pycallgraph-0.3.0. It take me several minutes before I realized that the function is named make_dot_graph.

Miroslav Suchy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.