You can profile an application by using the collect command from a terminal window or using Performance Analyzer.
To profile an application in Performance Analyzer do one of the following:
Click Profile Application in the Welcome screen.
Click the Profile Application toolbar button.
Choose File → Profile Application (Alt-F, E).
Run the analyzer command and specify the target program and its arguments on the command line.
Each of these methods open the Profile Application dialog box. Press F1 to view help information about the dialog.
The options in the Profile Application dialog correspond to the options available in the collect command, as described in Chapter 3, Collecting Performance Data.
Target Program is the only required entry if you want to use the default profiling options and collect only clock profiling data. Otherwise, you can specify experiment options in the General tab, and select the types of data you want to collect in the Data to Collect tab.
If you click the Preview Command button you can see the collect command that would be used when you click the Run button. Then simply click Run to start profiling, collecting data, and creating an experiment.
The target program's output is shown by default in a separate terminal window that is opened by Performance Analyzer. If you close the Profile Application dialog while an experiment is in progress, the experiment continues. If you reopen the dialog, it shows the experiment in progress, as if it had been left open during the run. If you attempt to exit Performance Analyzer while an experiment is in progress, a dialog box asks if you want the run terminated or allowed to continue.
To stop the experiment, click Terminate. You must confirm that you want to stop the experiment.
You can also profile a running process, as explained in the next section, and profile the kernel, as explained in Chapter 9, Kernel Profiling.