Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rewrite section on profilers
  • Loading branch information
esc committed Sep 2, 2011
1 parent 9feb315 commit 58bd2d6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions code/call-profiler
@@ -0,0 +1,2 @@
zsh» python -m cProfile -o profile-stats \
./wiki2beamer-0.9.2 slides.wiki > /dev/null
2 changes: 2 additions & 0 deletions code/generate-call-graph
@@ -0,0 +1,2 @@
zsh» gprof2dot.py -f pstats profile-stats |
dot -Tpdf -o profile_stats.svg
Binary file added images/call-graph.pdf
Binary file not shown.
28 changes: 26 additions & 2 deletions slides.wiki
Expand Up @@ -683,14 +683,38 @@ from my_product_fixed import my_product
* Only optimize your bottlenecks
* ...and identify these using a profiler
==== Profilers and Viewers ====

<[block]{Profiler}
* A tool to measure and provide statistics on the execution time of code.
* For example:
* A tool to measure and provide statistics on the execution of code.
** \href{http://docs.python.org/library/timeit.html}{timeit}
** \href{http://docs.python.org/library/profile.html}{cProfile}
** \href{http://packages.python.org/line_profiler/}{line profiler}
[block]>

<[block]{Viewer}
* Viewers display the profiler output, usually a call-graph
** \href{http://code.google.com/p/jrfonseca/wiki/Gprof2Dot}{gprof2dot}
** \href{http://www.vrplumber.com/programming/runsnakerun/}{run snake run}
** \href{http://kcachegrind.sourceforge.net/html/Home.html}{kcachegrind}
[block]>

==== Quick Example ====

<[block]{Call the Profiler}
\pyfile{code/call-profiler}
[block]>

<[block]{Generate the Call-Graph}
\pyfile{code/generate-call-graph}
[block]>

==== Call-Graph ====

<[figure]
<<<images/call-graph.pdf, scale=0.1>>>
[figure]>

==== Prototyping ====

* Ever tried to hit a moving target?
Expand Down

0 comments on commit 58bd2d6

Please sign in to comment.