Striving for greatness

The life and times of a Gentoo developer and leader

Code as artwork

Many people think of code as artwork in some way or another and consider good code something of elegance and beauty. While working today, I came across another example of that in a visual representation of a project I’m working on.

This image shows the call graph of the file I’m editing, which is one component of a much larger project. I made it with Python’s hotshot profiler and José Fonseca’s Gprof2dot. Brighter colors mean more time is spent in those functions or their children, although it’s hard to see at this size. Or does it show some sort of futuristic gun? Your call.

The above callgraph shows every single function, but here’s a profile generated with the same tools that shows only functions that use a certain percentage of time. You can actually see the colors:

Written by Donnie Berkholz

June 30, 2008 at 6:05 pm

Posted in Blog

Tagged with ,

5 Responses

Subscribe to comments with RSS.

  1. This is amazing. Code always has some sort of underlying order and structure. It’s awesome to see it visually represented like this.

    Thomas Cleberg

    June 30, 2008 at 11:11 pm

  2. At first glance, I thought it was a slightly squished map of the world.

    James Le Cuirot

    July 1, 2008 at 1:19 am

  3. [...] Donnie Berkholz is outputting profiler results in colour. [...]

  4. [...] Graphe d’appel en couleur: comment rendre (presque) joyeuse une tache de profiling (ousqu’on regarde à quel point ce qu’on a codé est lent à mourir) [...]

  5. http://rtprof.sourceforge.net/ is pretty neat too.

    Mikachu

    July 29, 2008 at 6:50 pm


Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 36 other followers

%d bloggers like this: