[Baypiggies] Fwd: Tools/libraries to determine the call graph(call flow) of an python program (module/package)

Joshua Rodman jrodman at splunk.com
Tue Jan 12 09:29:17 EST 2016

On Tue, Jan 12, 2016 at 02:36:31PM +0530, ashish makani wrote:
> Hi Folks,
> I am trying to do the following.
> I have a moderately complex python module/application X, whose source code
> i have access to.
> I run X with the following command
> python x.py <arg1> <arg2> ... <argn>
> Internally, x.py callls y.py, which in turn calls z.py, etc etc
> x.py ---> y.py ---> z.py ---> u.py ---> v.py

Do you mean that x imports y and runs code in it, or do you mean that
x creates a new process by running exec(["python", "y.py"]) ?

> Is there a python library/tool/module , to which i give input the start
> point of X, x.py
> and the input arguments, arg1, arg2, ..., argn
> and which can come up with the call graph of X
> I have tried looking at pycallgraph[0], but havent had much luck with it.
> 0. https://pypi.python.org/pypi/pycallgraph
> Any suggestions,advice, pointers welcome.

if you're just looking to get a cross-module callgraph of a single
python program, I have used this exact tool successfully, though it
took some work editing the intermediate data to get a nicely labelled

if you're trying to map out the call flow cross-process, then I don't
have any good ideas.

Splunk. Here.  There.  Everywhere.
JRodman.  Software Engineer.  Splunk Supportability Engineering
                o    .  o  .  o .  o  .  o  .  o
           o     Transportin' the softwares.
      .        ___   
     _n_n_n____i_i ________ ______________ _++++++++++++++_
  *>(____________I I______I I____________I I______________I
    /ooOOOO OOOOoo  oo oooo oo          oo ooo          ooo

More information about the Baypiggies mailing list