Overview of AMD CodeAnalyst

Program Performance Tuning

The program performance tuning cycle is an iterative process:

  1. Measure program performance.
  2. Analyze the results and identify program hot-spots.
  3. Identify the cause for any performance issues in the hot-spots.
  4. Change the program to remove performance issues.
AMD CodeAnalyst assists all four steps by collecting performance data, by analyzing and summarizing the performance data, and by presenting it graphically in many useful forms (tables, charts, etc.). CodeAnalyst directly associates performance information with software components such as processes, modules, functions and source lines. CodeAnalyst helps to identify the cause for a performance issue and where changes need to be made in the program.

The performance tuning cycle resembles the classic "scientific method" where a hypothesis (about performance) is made and then the hypothesis is tested through measurement. Measurement and analysis provide an objective basis for tuning decisions.

Performance analysis and tuning with CodeAnalyst consists of six steps:

  1. Prepare the application for analysis by compiling with generation of debug information turned on (an optional step).
  2. Select the kind of data to be gathered by choosing one of several predefined profile configurations.
  3. Configure run options such as the application program to be launched, the duration of data collection, etc.
  4. Start and perform data collection.
  5. Review and interpret the summarized results produced by CodeAnalyst.
  6. Make changes to the program's algorithm and source code, recompile/link, and analyze again.

Kinds of Analysis

AMD CodeAnalyst is a suite of tools that help improve the performance of an application program or system. CodeAnalyst provides several different ways of collecting and analyzing performance data.

Analysis usually begins with time-based profiling in order to find time-critical and time-consuming software components. Event-based profiling or instruction-based sampling is usually employed next in order to determine why a section of code is running more slowly than it should.

Flexible, System-Wide Data Collection

CodeAnalyst's data collection is system-wide, so performance data is collected about all software components that are executing on the system, not just the application program itself. CodeAnalyst collects data on application programs, dynamically loaded libraries, device drivers, and the operating system kernel. CodeAnalyst can be configured to monitor the system as a whole by not specifying an application program to be launched when data collection is started. Time-based profiling, event-based profiling, and instruction-based sampling collect data from multiple processors in a multiprocessor system. CodeAnalyst can also be used to analyze Java just-in-time (JIT) code.

Summarized Results with Drill-down

CodeAnalyst summarizes and displays performance information at several levels of granularity or "aggregation:"

The CodeAnalyst graphical user interface organizes and displays information at each of these levels and provides drill-down. Thus, CodeAnalyst provides an overview of available performance data (by process or by module) followed by drill-down to functions within a module, to source lines within a function, or even the instructions that are associated with a line of source code.

Graphical User Interface

The CodeAnalyst graphical user interface (GUI) provides an interactive workspace for the collection and analysis of program and system performance data.

Projects and Sessions

The CodeAnalyst GUI uses a project- and session-oriented user interface. A project retains important settings to control a performance experiment such as the application program to launch and analyze, settings that control data collection, etc. A project also organizes performance data into sessions. A CodeAnalyst session is created when performance data is collected through the GUI or when profile data is imported into the project. (The Oprofile command line utility is an alternative method for collecting data.) Session data is persistent and can be recalled at a later time. Sessions can be renamed and deleted.

Summary of GUI features

The CodeAnalyst GUI offers many features that make it easy to collect, view and analyze performance data. This subsection summarizes the main features offered by the CodeAnalyst GUI.

Organize and manage performance data in a CodeAnalyst project where a project consists of one or more sessions.

Configure and control program execution, and data collection such as:

Define important program properties and project options such as:

Collect performance data using time-based profiling, event-based profiling, and instruction-based profiling where available.

Display performance information in different formats such as:

Display performance information in different views such as:

Capture and save code produced by Java just-in-time (JIT) compilation.

Import performance data that was collected using the Oprofile command line utility.

Export data to allow post-processing using a spreadsheet program (or a user-written custom application).

Basic Steps for Analysis

The CodeAnalyst graphical user interface provides features to set up a performance experiment, run the experiment while collecting data, and display the results. The basic steps are:

  1. Open an existing project or create a new project.
  2. Set up basic run parameters like the program to launch, the working directory, etc.
  3. Select a predefined profile (data collection) configuration.
  4. Collect a time-based profile, event-based profile, or IBS-based profile as selected by the profile configuration.
  5. View and explore the results.
  6. Save the project and session data to review it later or to share it.

CodeAnalyst and Oprofile

CodeAnalyst leverages a third-party profiling tool called OProfile. CodeAnalyst uses Oprofile driver which is part of the Linux kernel, and a modified Oprofile daemon which includes additional functionality such as Java profiling. CodeAnalyst provides a graphical user interface that communicates with Oprofile daemon and Oprofile driver. AMD CodeAnalyst 2.7 requires Linux kernel that supports Oprofile version 0.9.1 and later.