Callgrind is a profiling tool that records call history among functions in a program's run as a call-graph. By default, the collected data consists of the number of instructions executed, their relationship to source lines, the caller/callee relationship between functions, and the numbers of such calls. Optionally, cache simulation and/or branch prediction (similar to Cachegrind) can produce further information about the runtime behavior of an application.
Questions tagged [callgrind]
121 questions
0
votes
0 answers
KCacheGrind/CallGrind - wrong relative timing
I am using valgrind to profile a program. The valgrind measurements shows a wrong relative runtime - it seems from the callgrind log that function1 has a longer runtime than function 2, although when I use a simple timer without valgrind, I see the…

Arik Vasserman
- 1
- 1
0
votes
1 answer
Callgrind / kcachegrind why does running a program in valgrind increase sysCall time?
I've been profiling some code which likely spends a lot of it's execution time in system calls. Timing some functions manually and with callgrind, callgrind reports system call times of around 20, 30 or 40 times longer than simply timing the…

GustavD
- 136
- 4
0
votes
0 answers
Callgrind / kcachegrind call graph output implies functions call eachother when they don't
I'm profiling C++ code using callgrind and then visualizing it in kcachegrind.
For example, if my program is:
main() {
function1();
function2();
}
I would expect main() to have two edges, one to function1() and everything called by…

GustavD
- 136
- 4
0
votes
1 answer
Should I trust profiling inside or outside of callgrind for a function that calls glibc's sin()?
I'm working on an audio library in which the sine of a number needs to be calculated within a very tight loop. Various levels of inaccuracy in the results might be tolerable for the user depending on their goals and environment, so I'm providing the…

Zoë Sparks
- 260
- 3
- 9
0
votes
0 answers
Valgrind ignore templates in output
I'm using valgrind [callgrind] to profile a C++ executable, and KCachegrind to display the results. However, the function names are all but unreadable due to endless template names before the actual method name. Since each class is instantiated with…

Francesco Dondi
- 1,064
- 9
- 17
0
votes
1 answer
Optimizations of nested if and switch statements using callgrind or assembly modifications
Consider this piece of code
| 34 static bool
| 35 _valid_character(char *str, size_t *idx)
| 36 { …

washcloth
- 2,730
- 18
- 29
0
votes
1 answer
Getting consistent callgrind output over multiple runs
I've been using valgrind to do some profiling on a C++ codebase, and based on my understanding it's performing sampling of individual calls to build its profile data. As a result, I can profile the same application twice using something like…

Chip Bell
- 65
- 4
0
votes
1 answer
Using callgrind to find out which functions are most intensive
I have just used callgrind on a file and it gave me a callgrind output. Then I used callgrind_annotate to get the results in a more readable form, and I output it into a text file. How am I supposed to decipher this new file to find out which…

hut123
- 1
0
votes
1 answer
callgrind no source available for a couple of functions only
I am using linux and I am trying to debug an executable that I launch from the command line. It calls some functions from another custom library that I linked to it. I built both my executable and my library with the debug flags (-g3) then I ran it…

PrOpoLo
- 85
- 5
0
votes
6 answers
Logging code execution in C++
Having used gprof and callgrind many times, I have reached the (obvious) conclusion that I cannot use them efficiently when dealing with large (as in a CAD program that loads a whole car) programs. I was thinking that maybe, I could use some C/C++…

John
- 687
- 1
- 6
- 15
0
votes
1 answer
Why does Callgrind make atomic load never ending
I wrote a small program that works perfectly fine until it's being dynamically instrumented by Callgrind:
$ g++ -std=c++11 -pthread -g -ggdb -o program.exe program.cpp
$ time valgrind --tool=callgrind ./program.exe
The code:
#include…

Viet
- 17,944
- 33
- 103
- 135
0
votes
0 answers
Sqlite database empty when profiling with callgrind
I am attempting to profile a program that requires data loaded from a sqlite database. Running the program normally works as expected, but when I use callgrind the opened database is empty (no tables; a user_version that is set in the database comes…

ioums
- 1,367
- 14
- 20
0
votes
1 answer
how to install kcachegrind on linux or cirrus?
I am working on a cirrus machine, having my C code profiled. I have Valgrind installed on it. But the output I get from --tool=callgrind is barely understandable, hence I want to use kcachegrind tool. But I am not able to find a link to install it…

Akhil Haridasan
- 13
- 3
0
votes
1 answer
How to use Callgrind to profile specific functions?
Following this, I wrapped my functions with CALLGRIND_xxx_INSTRUMENTATION macros. However, I always get "out of memory".
Here is a simplified version of my program and callgrind would still run out of memory even though I could run callgrind without…

zhao
- 232
- 3
- 15
0
votes
1 answer
callgrind does not profile C functions called by interpreter languages
My main program is written by C. The C code calls an interpreter language, say python, by its C APIs. Then the interpreter language calls back to other C APIs. All the C code are debuggable, the interpreter language's C interface is also…

Joe C
- 2,757
- 2
- 26
- 46