Chapter 19. Profile Mode

Table of Contents

Intro
Using the Profile Mode
Tuning the Profile Mode
Design
Wrapper Model
Instrumentation
Run Time Behavior
Analysis and Diagnostics
Cost Model
Reports
Testing
Extensions for Custom Containers
Empirical Cost Model
Implementation Issues
Stack Traces
Symbolization of Instruction Addresses
Concurrency
Using the Standard Library in the Instrumentation Implementation
Malloc Hooks
Construction and Destruction of Global Objects
Developer Information
Big Picture
How To Add A Diagnostic
Diagnostics
Diagnostic Template
Containers
Hashtable Too Small
Hashtable Too Large
Inefficient Hash
Vector Too Small
Vector Too Large
Vector to Hashtable
Hashtable to Vector
Vector to List
List to Vector
List to Forward List (Slist)
Ordered to Unordered Associative Container
Algorithms
Sort Algorithm Performance
Data Locality
Need Software Prefetch
Linked Structure Locality
Multithreaded Data Access
Data Dependence Violations at Container Level
False Sharing
Statistics
Bibliography

Intro

Goal: Give performance improvement advice based on recognition of suboptimal usage patterns of the standard library.

Method: Wrap the standard library code. Insert calls to an instrumentation library to record the internal state of various components at interesting entry/exit points to/from the standard library. Process trace, recognize suboptimal patterns, give advice. For details, see the Perflint paper presented at CGO 2009.

Strengths:

  • Unintrusive solution. The application code does not require any modification.

  • The advice is call context sensitive, thus capable of identifying precisely interesting dynamic performance behavior.

  • The overhead model is pay-per-view. When you turn off a diagnostic class at compile time, its overhead disappears.

Drawbacks:

  • You must recompile the application code with custom options.

  • You must run the application on representative input. The advice is input dependent.

  • The execution time will increase, in some cases by factors.

Using the Profile Mode

This is the anticipated common workflo