calltrace

by adam marks (email)


implementation notes

There are two components to the system: the calltrace valgrind plugin, which generates function call data by instrumenting the program as it runs inside of valgrind, and the calltrace-client, which is a Mac OS X application that draws the openGL graphics based on the calltrace data.

The visualization may be done live by running valgrind on a linux machine, running the client on an OS X machine, and connecting the two by a simple script that reads the calltrace data and makes it available on a socket to which the client connects.

Or, the calltrace data can be simply logged to a file, and the client can replay it at a later time.

The calltrace data itself follows a simple textual protocol that contains function definitions and function entrances one per line with a delta timestamp.

There are two caveats/bugs that I hope to address at a later date (in Calltrace 2 perhaps). First, the size of each function box is meant to be proportional to the size of the function in instructions. Something seems to be amiss with the implementation of this since very often the size is 46. Second, I wanted to have each function box lit for the duration of the call. However, facing time constraints I was not able to figure out how to instrument all manners of function exits, and thus what is implemented is a simple static delay before the call fadeout.

source code