Generating a callgraph by using Doxygen and Graphviz

One of the questions of my OS assignment asks me to draw a callgraph. It can be one-time task and I can draw it on a piece of paper. Soon I noticed that the one that I want to draw is much bigger in size that I can simply draw on a paper. Also I wanted to draw it in ‘fancier’ way. I search the Internet, and I found this is one of the choices.

The following is what I have done.

  1. Install Doxygen and Graphviz. In my case, I only had to install Graphviz (and I am using linux fedora)
    sudo yum install graphviz
  2. Go to the folder where your source files are located.
  3. doxygen -g
    This will generate a configuration file, named ‘Doxyfile’.
  4. Modify Doxyfile if necessary. To generate a callgraph, you need to set up appropriately. I changed the following properties.
    HAVE_DOT               = YES
    EXTRACT_ALL            = YES
    EXTRACT_STATIC         = YES
    CALL_GRAPH             = YES
  5. Then you run doxygen:
    doxygen Doxyfile
  6. New folder ‘html’ and ‘latex’ will be generated, and you can find all the documentations in the folders.

This is an example of callgraph generated by doxygen.



3 thoughts on “Generating a callgraph by using Doxygen and Graphviz

  1. Thanks–I was trying to generate a callgraph for downloaded code, and couldn’t understand why I wasn’t getting one. Turns out it’s because I missed the EXTRACT_* options. It’s good to see a description of someone doing exactly what I’m trying to do, since I only just downloaded Doxygen for this purpose and otherwise would have had to read through all the documentation.

  2. Be aware that even when installed by default the doxygen version on Fedora might be a bit outdated (current version is 1.8.14).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s