CallGraphs with PerfTool

Published 07 Feb 2014 by Emir Habul.

Goal is to show callgraphs of any process

perf record -g ./foo
perf script | ./gprof2dot.py -f perf | dot -Tpng -o foo.png

This utility comes from jrfonseca's Gprof2Dot page, direct download link is: gprof2dot.py (local mirror).

Produces:

And test program

#include <stdio.h>

int sum = 0;
#define LOOP()                    \
  {                               \
    int j;                        \
    for (j = 0; j < 10000; j++) { \
      sum += j;                   \
    }                             \
  }

int f() { LOOP(); }
int d() { LOOP(); f(); }
int e() { LOOP(); f(); }
int c() { LOOP(); d(); LOOP(); e(); }
int b() { LOOP(); c(); }
int a() { LOOP(); c(); }

int main() {
  int i;
  for (i = 0; i < 10000; i++) {
    a();
    b();
  }
}

Tags


My jekyll installation for a personal website

Published 07 Feb 2014 by Emir Habul.

You'll find this post in your _posts directory - edit this post and re-build (or run with the -w switch) to see your changes! To add new posts, simply add a file in the _posts directory that follows the convention: YYYY-MM-DD-name-of-post.ext.

Compiling jekyll blog:

jekyll serve --detach
jekyll build --watch

Jekyll extensions

<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

\begin{equation} \sqrt{4} + 1 \ne 5 \frac{1}{2} \end{equation}

def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.

Check out the Jekyll docs for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll's GitHub repo.

See it on this site at /projects

Tags