[BangPypers] BangPypers Digest, Vol 101, Issue 4

Mithran Daniel mithran77 at gmail.com
Thu Jan 14 09:29:48 EST 2016


Have you tried this?
http://stackoverflow.com/questions/1896032/using-cprofile-results-with-kcachegrind

This uses Qcachegrind to display cProfile data.
Hope I didn't hijack your thread, but I have been trying to understand what
function cycles mean.
I had read that valgrind tries to simulate a processor while running.
Can someone please shed some light about cycles in cachegrind with python
cProfile data?

On Tue, Jan 12, 2016 at 10:30 PM, <bangpypers-request at python.org> wrote:

> Send BangPypers mailing list submissions to
>         bangpypers at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/bangpypers
> or, via email, send a message with subject or body 'help' to
>         bangpypers-request at python.org
>
> You can reach the person managing the list at
>         bangpypers-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of BangPypers digest..."
>
>
> Today's Topics:
>
>    1. Tools/libraries to determine the call graph(call flow) of an
>       python program (module/package) (ashish makani)
>    2. Re: Tools/libraries to determine the call graph(call flow) of
>       an python program (module/package) (Vasudev Ram)
>    3. Re: Tools/libraries to determine the call graph(call flow) of
>       an python program (module/package) (Noufal Ibrahim KV)
>    4. Re: Tools/libraries to determine the call graph(call flow) of
>       an python program (module/package) (ashish makani)
>    5. Re: Tools/libraries to determine the call graph(call flow) of
>       an python program (module/package) (Noufal Ibrahim KV)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 12 Jan 2016 14:42:31 +0530
> From: ashish makani <ashish.makani at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: [BangPypers] Tools/libraries to determine the call graph(call
>         flow) of an python program (module/package)
> Message-ID:
>         <CAEX1urhF1ekWL=
> updRCjE5ap+ACr88X9TXR4t1LDSCPw6EoAVw at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi fellow bangalore pythonistas ,
>
> 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
>
> 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.
>
> Thanks a ton,
> ashish
>
>
> *"Talk is cheap. Show me the code."    - Linus Torvalds [*
> * https://lkml.org/lkml/2000/8/25/132* <
> https://lkml.org/lkml/2000/8/25/132>
> * ]*
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 12 Jan 2016 15:31:16 +0530
> From: Vasudev Ram <vasudevram at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>,
>         Vasudev Ram <vasudevram at gmail.com>
> Subject: Re: [BangPypers] Tools/libraries to determine the call
>         graph(call flow) of an python program (module/package)
> Message-ID:
>         <
> CAM3uJy+W020ObTT7AxPPpGadDT6LY2N4jOaBF8REH2uq5fso6w at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Have you tried the trace module from the stdlib?
>
> https://docs.python.org/2/library/trace.html
>
> Has both a CLI and a lib you can use.
>
> See this example:
>
> http://jugad2.blogspot.tw/2013/06/pythons-trace-module-and-chained.html
>
> Also this:
>
> http://jugad2.blogspot.in/2013/04/using-syscurrentframes-and-python.html
>
> - Vasudev
> jugad2.blogspot.com
>
> On Tuesday, January 12, 2016, ashish makani <ashish.makani at gmail.com>
> wrote:
>
> > Hi fellow bangalore pythonistas ,
> >
> > 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
> >
> > 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.
> >
> > Thanks a ton,
> > ashish
> >
> >
> > *"Talk is cheap. Show me the code."    - Linus Torvalds [*
> > * https://lkml.org/lkml/2000/8/25/132* <
> > https://lkml.org/lkml/2000/8/25/132>
> > * ]*
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org <javascript:;>
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
> --
> Vasudev Ram - Dancing Bison Enterprises
> Fellow at the Python Software Foundation
> Independent software consultant and trainer
> - Python, C, Linux, databases, open source
> About: http://jugad2.blogspot.in/p/about-vasudev-ram.html
> LinkedIn: http://www.linkedin.com/in/vasudevram
> ActiveState Code recipes:
> https://code.activestate.com/recipes/users/4173351
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 12 Jan 2016 15:18:16 +0530
> From: Noufal Ibrahim KV <noufal at nibrahim.net.in>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] Tools/libraries to determine the call
>         graph(call flow) of an python program (module/package)
> Message-ID: <874mejxh5r.fsf at nibrahim.net.in>
> Content-Type: text/plain
>
> On Tue, Jan 12 2016, ashish makani wrote:
>
> [...]
>
> > 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
>
> I once needed something like this but went about it statically using
> this
> http://code.activestate.com/recipes/577222-create-module-dependency-graph/
> and then added some project specific stuff into it. It got me what I
> wanted.
>
> Generally though, the simplest way would be to stick an
>
>           import pdb; pdb.set_trace()
>
> inside the appropriate function in v.py and then look at the call stack no?
>
>
> [...]
>
>
> --
> Cordially,
> Noufal
> http://nibrahim.net.in
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 12 Jan 2016 18:07:07 +0530
> From: ashish makani <ashish.makani at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] Tools/libraries to determine the call
>         graph(call flow) of an python program (module/package)
> Message-ID:
>         <CAEX1urgCxUYZrWRZpMag864DnUUgbvMeuxM-8ONhRECHHA=
> J4w at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> thanks & true Noufal, but 2 points :
>
> 1. i imagine this is a fairly common usecase
> you are given some source python codebase , X which is moderately complex
>
> i just want to give X & some typical args which X takes,
> to a tool/library, so i get a visual, rough understanding of the typical
> call flow when X is run.
> As in, i dont want to instrument or "decorate" the python codebase X, treat
> X as a blackbox
> what say ?
>
>
> 2. it seems like some easy to use library is out there
> which spits out that pretty visual call flow diagram/graph
>
> which seems more intuitive(though maybe less precise  ?) than
> a text call stack
>
> thanks
> ashish
>
> On Tue, Jan 12, 2016 at 3:18 PM, Noufal Ibrahim KV <noufal at nibrahim.net.in
> >
> wrote:
>
> > On Tue, Jan 12 2016, ashish makani wrote:
> >
> > [...]
> >
> > > 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
> >
> > I once needed something like this but went about it statically using
> > this
> >
> http://code.activestate.com/recipes/577222-create-module-dependency-graph/
> > and then added some project specific stuff into it. It got me what I
> > wanted.
> >
> > Generally though, the simplest way would be to stick an
> >
> >           import pdb; pdb.set_trace()
> >
> > inside the appropriate function in v.py and then look at the call stack
> no?
> >
> >
> > [...]
> >
> >
> > --
> > Cordially,
> > Noufal
> > http://nibrahim.net.in
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 12 Jan 2016 18:18:35 +0530
> From: Noufal Ibrahim KV <noufal at nibrahim.net.in>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] Tools/libraries to determine the call
>         graph(call flow) of an python program (module/package)
> Message-ID: <8760yzvu8s.fsf at nibrahim.net.in>
> Content-Type: text/plain
>
> On Tue, Jan 12 2016, ashish makani wrote:
>
> > thanks & true Noufal, but 2 points :
> >
> > 1. i imagine this is a fairly common usecase
> > you are given some source python codebase , X which is moderately complex
> >
> > i just want to give X & some typical args which X takes, to a
> > tool/library, so i get a visual, rough understanding of the typical
> > call flow when X is run.  As in, i dont want to instrument or
> > "decorate" the python codebase X, treat X as a blackbox what say ?
>
> That makes sense. The trace[1] module, which, I must confess, is new to me,
> mentioned by Vasudev looks like exactly what you need. It should be
> simple to instrument your code with that module, get the call graph and
> then use graphviz or some similar tool to draw a picture of it.
>
>
> > 2. it seems like some easy to use library is out there which spits out
> > that pretty visual call flow diagram/graph which seems more
> > intuitive(though maybe less precise ?) than a text call stack
>
> Of course. Different strokes for different folks.
>
> [...]
>
>
>
> Footnotes:
> [1]  https://pymotw.com/2/trace/
>
> --
> Cordially,
> Noufal
> http://nibrahim.net.in
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
>
> ------------------------------
>
> End of BangPypers Digest, Vol 101, Issue 4
> ******************************************
>



-- 
Thanks and Regards,
Mithran
+91 9986759380


More information about the BangPypers mailing list