Difference between revisions of "Gprof Tutorial"
(another question) |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 35: | Line 35: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | + | + | + by instrumenting the application during compilation |
|| True | || True | ||
− | - | + | - through static analysis of the source code |
|| | || | ||
− | - | + | - by means of hardware performance counters |
|| | || | ||
</quiz> | </quiz> | ||
Line 50: | Line 50: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | + | + | + <code>-pg</code> |
|| True | || True | ||
− | - | + | - <code>-pig</code> |
|| | || | ||
− | - | + | - <code>--profile</code> |
|| | || | ||
</quiz> | </quiz> | ||
Line 60: | Line 60: | ||
{{hidden begin | {{hidden begin | ||
− | |title = 4. Which | + | |title = 4. Which compilers support Gprof? |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - only commercial compilers | + | - only the commercial Intel compilers |
|| | || | ||
- only open-source compilers (e.g., from GNU) | - only open-source compilers (e.g., from GNU) | ||
Line 80: | Line 80: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - | + | - simple and understandable |
|| | || | ||
− | + | + | + representative of a usual workload |
|| True | || True | ||
− | - | + | - covering edge cases |
|| | || | ||
</quiz> | </quiz> | ||
Line 95: | Line 95: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - | + | - only small examples |
|| | || | ||
− | - | + | - up to medium-sized applications with a running time below ~1 hour |
|| | || | ||
− | + | + | + all, even large real-world examples with huge running times |
|| True | || True | ||
</quiz> | </quiz> | ||
Line 110: | Line 110: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - | + | - an android app to show incoming callers |
|| | || | ||
− | + | + | + a hierarchy diagram of function calls in a given profile |
|| True | || True | ||
− | - | + | - instructions of how to call for help during emergencies |
|| | || | ||
</quiz> | </quiz> | ||
Line 140: | Line 140: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | + | + | + third-party script for call graph visualization via the "dot" library |
|| True | || True | ||
- Gprof feature to export profiles as a pdf | - Gprof feature to export profiles as a pdf | ||
|| | || | ||
− | - | + | - a fork of the beta version of Gprof2 |
|| | || | ||
</quiz> | </quiz> | ||
Line 155: | Line 155: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - | + | - no, Gprof only works with sequential applications |
|| | || | ||
− | + | + | + yes, but Gprof cannot differentiate between individual threads or processes |
|| True | || True | ||
− | - | + | - yes, parallel profiling is the main use-case of Gprof |
|| | || | ||
</quiz> | </quiz> | ||
Line 170: | Line 170: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - | + | - none |
|| | || | ||
− | + | + | + little |
|| True | || True | ||
− | - | + | - much |
|| | || | ||
</quiz> | </quiz> | ||
{{hidden end}} | {{hidden end}} |
Latest revision as of 17:48, 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