Performance Analysis

What is the purpose of using a profiler when improving program performance?

  1. ATo find grammar errors in the program
  2. BTo count the program's users
  3. CTo find which functions or parts of a program consume most of the execution time
Show answer and explanation

Answer: C. To find which functions or parts of a program consume most of the execution time

In many programs most execution time is spent in a tiny fraction of the code, but human guesses about where the slowness lies are often wrong. A profiler measures and displays time and call counts per function, and even per line or instruction. As Amdahl's law implies, improving the parts that take the most time is most effective, so measuring is the first step in performance improvement.

  • A. The compiler finds grammar errors.
  • B. It has nothing to do with user counts.
  • C. Correct. It shows where improvement should go.
Practice this topic Back to topic

More Performance Analysis questions

  1. What characterizes a sampling profiler?
  2. Which statement about instrumentation profilers, which insert timing code at function entries and exits, is correct?
  3. In program performance analysis, what is a hotspot?
  4. How is a flame graph, used to present profiling results, read?
  5. Which is an example of what CPU performance counters (the PMU) can count?