Using Callgrind

Complete: 3

Goal of the page

This page is intended to provide a short introduction to callgrind tool and its usage to measure the performance of CMS offline code


Vincenzo Innocente
Robin Moser


Cachegrind and Callgrind are tools from the valgrind tool suite.

Cachegrind is a cache profiler. It performs detailed simulation of the I1, D1 and L2 caches in your CPU and so can accurately pinpoint the sources of cache misses in your code. It identifies the number of cache misses, memory references and instructions executed for each line of source code, with per-function, per-module and whole-program summaries. It is useful with programs written in any language. Cachegrind runs programs about 20--100x slower than normal.

Callgrind Is an extension to Cachegrind (another val. It provides all the information that Cachegrind does, plus extra information about callgraphs. Available separately is an amazing visualisation tool, KCachegrind, which gives a much better overview of the data that Callgrind collects; it can also be used to visualise Cachegrind's output.


Callgrind is available together with valgrind on most of the Linux distributions. CMS distributes its own version of valgrind and callgrind. We recommend therefore to use the version made available in the CMSSW runtime environment.

to instrument an executable for performance measurement (say cmsrun my.cfg) just run it under valgrind as valgrind --tool=callgrind cmsrun my.cfg from a shell initialized with the CMSSW runtime environement.

Several options exist, in particular to limit the instrumentation to given part of the code. Please refers to ProfilerService documentation for mode details.


Please refer to the original documentation available on the web or with the valgrind distribution


For more example and a tutorial on how to use callgrind with cms offline software please refer to the workbook.

Review status

Reviewer/Editor and Date (copy from screen) Comments
KatiLassilaPerini - 15 Mar 2007 created template page

Responsible: VincenzoInnocente
Last reviewed by: Most recent reviewer

-- CMSUserSupport - 15 Mar 2007

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2007-04-26 - VincenzoInnocente

    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback