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
4
votes
1 answer
Kcachegrind/callgrind is inaccurate for dispatcher functions?
I have a model code on which kcachegrind/callgrind reports strange results. It is kind of dispatcher function. The dispatcher is called from 4 places; each call says, which actual do_J function to run (so the first2 will call only do_1 and do_2 and…

osgx
- 90,338
- 53
- 357
- 513
4
votes
0 answers
How to generate a simple callgraph of a multiprocess application with Callgrind?
I've a problem with Valgrind Callgrind.
I need to generate the call graph of an application, but this application launch several processes. I used the --trace-children=yes option of Valgrind, but that generates several different callgrind output…

Baptiste Wicht
- 7,472
- 7
- 45
- 110
4
votes
1 answer
CMake 3.16 orders of magnitude slower in the Generate phase for Makefiles compared to older versions
I'm consulting a company on how to speed up their builds and I immediately pointed them to precompiled headers and unity builds - the 10 minute full build could easily drop to 2-3 minutes. Luckily CMake 3.16 was recently released and it supports…

onqtam
- 4,356
- 2
- 28
- 50
4
votes
1 answer
What exactly is self time in C++ Callgrind?
I am programming in C++ (on Linux) and I have recently started to use Valgrind/Callgrind to optimise my code. After reading a couple tutorials it seems that focusing on functions with highest 'self' cost is a good idea.
I found two functions with…

The Authors
- 131
- 5
4
votes
1 answer
valgrind/callgrind: what is `_dl_runtime_resolve_xsave`
I'm currently trying to analyze and debug performance issues of a library I'm using. For this reason, I wrote a short C++ code that would use some of the core features of this library and run a simple timer on it.
In order to dive a bit deeper, I…

carsten
- 1,315
- 2
- 13
- 27
4
votes
2 answers
Difference between Very sleepy and Callgrind for C++ profiling
I am trying to learn the difference between Very Sleepy and Callgrind for profiling. The code that I intend to profile is written in C++ and works under both Linux and Windows.
On Linux, I was able to use Callgrind to look at the Self and inclusive…

hypersonics
- 1,064
- 2
- 10
- 23
4
votes
1 answer
Valgrind on linux: delaying start of activation
Using
valgrind --tool=callgrind
on Linux
.....I would like to pass canned messages into my process. However for the first eg 90% of the messages I would like to process as normal, with no grinding, in order to build up a map. Then I would like to…

user1981105
- 41
- 3
3
votes
2 answers
Callgrind performance analysis with cycle detection
I'm trying to use Callgrind/Kcachegrind for the first time to profile my C++ application and what I noticed is that the two functions that take more time are:
< cycle 1 > (50% self) and
do_lookup_x (15% self)
Now, from my understanding cycle 1 is…

arandomuser
- 521
- 1
- 7
- 22
3
votes
2 answers
What profiler should I use to measure _real_ time (including waiting for syscalls) spend in this function, not _CPU_ one
The application does not calculate things, but does i/o, read files, uses network. I want profiler to show it.
I expect something like something like in callgrind that calls clock_gettime each proble.
Or like oprofile that interrupts my application…

Vi.
- 37,014
- 18
- 93
- 148
3
votes
3 answers
Use callgrind as a sampling profiler?
I've been searching for a Linux sampling profiler, and callgrind has come the closest to showing useful results. However the overhead is estimated at 20--100x slower than normal. Additionally, I'm only interested in time spent per function (with…

Matt Joiner
- 112,946
- 110
- 377
- 526
3
votes
0 answers
C++ profiling reveals vector hotspot. How to optimize?
I am profiling some signal processing code using callgrind / qcachegrind involving many operations on std::vector.
I'm getting quite a serious hotspot from the Mac OS builtin nearbyint function.
This seems to be called almost entirely by…

learnvst
- 15,455
- 16
- 74
- 121
3
votes
0 answers
Valgrind and time give opposite results
I have some (Fortran) code which accumulates data into an array, essentially doing this:
complex,dimension(4000)::a,b
complex :: c
[...]
a=0.
do i=1,20000
b=foo(...)
c=bar(...)
a=a+b*c
end do
Using callgrind, I learn that most of my…

avid
- 145
- 3
3
votes
1 answer
C++ profiling: clock cycle count
I'm using valgrind --tool=callgrind to profile a critical part of my C++ program.
The part itself takes less that a microsecond to execute so I'm profiling over a large number of loops over that part.
I noticed that instructions take multiples of…

haelix
- 4,245
- 4
- 34
- 56
3
votes
1 answer
callgrind with spawn-fcgi not creating profiling data
I need to profile my c++ application which starts with spawn-fcgi.
I tried to use callgrind but callgrind output in KCachegrind is not showing any information of my applications.
valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes…

Anurag
- 117
- 1
- 13
3
votes
1 answer
Profiling library equivalent to gprof/callgrind
I'm looking for a C/C++ library with profiling capabilities such as gprof, or callgrind.
More precisely, I want its output to be equivalent to what callgrind would issue, in order to pass it to third-party tools such as KCacheGrind.
The idea is to…

jopasserat
- 5,721
- 4
- 31
- 50