Difference between revisions of "Gprof Tutorial"
(reworked and extended the introduction part) |
(editing of the quiz questions and answers) |
||
Line 15: | Line 15: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 1. What | + | |title = 1. What languages can Gprof profile? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
Line 30: | Line 30: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 2. How does | + | |title = 2. How does Gprof generate a performance profile of an application? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
Line 38: | Line 38: | ||
|| True | || True | ||
- Through static analysis of the source code | - Through static analysis of the source code | ||
+ | || | ||
+ | - By means of hardware performance counters. | ||
|| | || | ||
</quiz> | </quiz> | ||
Line 58: | Line 60: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 4. How should the parameters be when running the instrumented application? | + | |title = 4. How should the input parameters be when running the instrumented application? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
Line 88: | Line 90: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 6. How do you generate a | + | |title = 6. How do you generate a call graph of a Gprof profile? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
Line 95: | Line 97: | ||
- gprof --call-graph | - gprof --call-graph | ||
|| | || | ||
− | - gprof | + | - gprof-call-graph |
|| | || | ||
+ gprof --graph | + gprof --graph | ||
Line 112: | Line 114: | ||
- Gprof feature to export profiles as a pdf | - Gprof feature to export profiles as a pdf | ||
|| | || | ||
− | - A fork of the beta version of | + | - A fork of the beta version of Gprof2 |
|| | || | ||
</quiz> | </quiz> | ||
Line 118: | Line 120: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 8. Does | + | |title = 8. Does Gprof work with parallel applications? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - No, | + | - No, Gprof only works with sequential applications |
|| | || | ||
− | - Yes, parallel profiling is the main use case of | + | + Yes, but Gprof cannot differentiate between individual threads or processes |
+ | || True | ||
+ | - Yes, parallel profiling is the main use-case of Gprof | ||
|| | || | ||
− | |||
− | |||
</quiz> | </quiz> | ||
{{hidden end}} | {{hidden end}} | ||
{{hidden begin | {{hidden begin | ||
− | |title = 9. How much overhead does | + | |title = 9. How much overhead does Gprof produce? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> |
Revision as of 14:43, 3 December 2020
This tutorial deals with the topic of applications performance analysis with the GNU profiler Gprof. Profiling applications gives valuable insights into the program structure and exposes performance bottlenecks, which point to sections of the code where optimizations are most effective.
The tutorial covers all necessary basics to get started with Gprof: it shows how to instrument applications, how to generate performance information for an application run and how to evaluate the results. In addition, it explains how to visualize the application structure using call graphs and how to annotate the application's source code with runtime information. Three real-world examples from the areas of biology, computer science and mechanical engineering demonstrate that this works with different programming languages (C/C++, Fortran), different compilers (GNU, Intel) and even parallel applications (threads, MPI).
Quiz