Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a easy one. I need to profile Linux C++ programs: Must requirements: fre

ID: 660103 • Letter: T

Question

This is a easy one. I need to profile Linux C++ programs:

Must requirements:

free for non-commercial use
work with gcc (g++) compiled programs
work with x86-64 programs.
profile programs compiled with optimizations enable (-O3). (* see footnote)
display real (demangled) symbol names, even with optimization enable. (* see footnote)

Useful features:

easy to use for basic profiling (detect the hot code)
line granularity (which lines within a function are hot)
assembly instructions granularity

Would be nice features:

GUI (even 3'rd party)
easy to install

Future requirements (I don

Explanation / Answer

I profile my programs with the valgrind plugin/tool callgrind.

For me, this works under x86_64 with optimizations as -O3 when adding debugging symbols with -g. Valgrind is licensed under the GPL.

The output can be visualized with kcachegrind or the Eclipse Linux Tools

The callgrind manual states, that it can do assembly analysis and deal with forks if they correctly annotated in source.

It is easy to use:

valgrind --tool=callgrind ./path/to/executable

It runs the program slower than normal and creates a file callgrind.out.$pid where $pid is the pid of the invocation (it is the number displayed in every line of callgrind's output ==$pid==).

It can then be visualized in kcachegrind with

kcachegrind callgrind.out.$pid

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote