CPU Profile Command Line Interface

CodeXL

PreviousNext
CodeXL User Guide
Help > Using CodeXL > CPU Profiler > CPU Profile Command Line Interface
CPU Profile Command Line Interface

CodeXL CPU Profiler provides a command line interface utility for users who prefer to use command interpreters like cmd.exe on Windows and bash on Linux. This CLI utility will be used to collect and analyze the profile data. It can also be used from a batch file or a test script.

Usage: CodeXLCpuProfiler.exe command <options> [<InputApplication>] [<InputApplication’s command line arguments>]

Following commands are supported:

collect

Run the given input application and collect cpu profile samples.

report

Process the given cpu profile data file and generate a cpu profile report in CSV format.

 

Following options are supported with collect command.

-m <profile type>

Predefined profile type to be used to collect samples. Supported profile types are:

tbp: Time-based Sampling

assess: Assess Performance

branch: Investigate Branching

data_access: Investigate Data Access

ibs: Instruction-based Sampling

inst_access: Investigate Instruction Access

l2_access: Investigate L2 Cache Access

clu: Cache Line Utilization (Windows only)

-T <n>

Sampling interval for custom time-based profiling (tbp). Sampling interval <n> is specified in milliseconds.

-d <n>

Profile duration in seconds.

-o <file name>

Base name of the output file. If this option is specified, default path will be used. The default path will be %Temp%\Codexl-CpuProfile-<timestamp> on Windows and /tmp/Codexl-CpuProfile-<timestamp> on Linux.

-p <PID,PID,..>

Profile existing processes (processes to attach to). Process IDs are separated by comma.

-a

System Wide Profile (SWP). If this flag is not set then the command line tool will profile only the launched application or the PIDs attached.

-G

Enable callstack sampling with default Callstack collection sampling interval and Unwind Depth. The default values are:

Callstack Collection Sampling Interval: 1

Unwind Depth: 128

-g <Interval:Depth:Scope:Fpo>

Enable callstack sampling with user defined callstack collection sampling interval, unwind depth, scope and FPO values. Scope and FPO are Windows only options.

(Windows only)

Scope should contain one of these options:

user: Collect callstacks only for code executed in user space.

kernel: Collect callstacks only for code executed in kernel space.

all: Collect callstacks for code executed in user space and kernel space.

To collect missing frames due to omission of frame pointers by compiler.

fpo: Collect missing callstack frames.

nofpo: Do not collect missing callstack frames. (default)

-c

Core Affinity Mask. Default affinity is all the available cores. In System-wide profiling, samples are collected only from these cores. In Per-Process profile, processor affinity is set for the launched application.

-f

Profile the children of the launched application (i.e. processes launched by the profiled application).

-b

Terminate the launched application after profile collection.

-s <n>

Start profiling after the specified delay duration <n> in seconds.

-v

Print version string.

-w

Specify the working directory. Default will be the path of the launched application.

-h

Displays this help information.

-C <Custom profile>

Path to the custom profile XML file.

 

Following options are supported with report command.

-i <file name>

Input file name. Either the raw profile data file (.prd on Windows and .caperf on Linux) or the processed data file (.ebp) can be specified.

-o <output dir>

Output directory in which the processed data file (ebp and imd) will be created. The default path will be %Temp%\<base-name-of-input-file> on Windows and /tmp/<base-name-of-input-file> on Linux.

-V <view xml>

Specify the View configuration XML file. All the raw data will be reported.

-R <section,..>

Specify the report sections to be generated. Supported report sections are:

all: Report all the sections.

overview: Report Overview section.

process: Report process details.

module: Report module details.

callgraph: Report callgraph.

Options process and module are mutually exclusive. Options module and callgraph are mutually exclusive.

-e

Specify the event index for which callgraph will be generated. This event is also used to find the hot functions in the Overview section.

-I

Ignore samples from System Modules.

-P

Show Percentage.

 

Examples

·         Launch the application classic.exe and collect Time-based profile (TBP) samples:

CodeXLCpuProfiler.exe collect -m tbp -o c:\Temp\cpuprof-tbp classic.exe

·         Launch the application classic.exe and collect assess performance profile samples for the duration of 10 seconds:

CodeXLCpuProfiler.exe collect -m assess -o c:\Temp\cpuprof-assess -d 10 classic

·         Launch the application classic.exe and collect Instruction Based Sampling (IBS) samples in System wide profile (SWP) mode:

CodeXLCpuProfiler.exe collect -m ibs -a -o c:\Temp\cpuprof-ibs-swp classic

·         Collect Time-based profile samples in System wide profile mode for the duration of 10 seconds:

CodeXLCpuProfiler.exe collect -m tbp -a -o c:\Temp\cpuprof-TBP-swp -d 10

·         Launch the application classic.exe and collect Time-based profile (TBP) samples. Also enable collecting callstack samples whenever the TBP samples are collected:

CodeXLCpuProfiler.exe collect -m tbp -G -o c:\Temp\cpuprof-tbp classic.exe

·         Print help:

CodeXLCpuProfiler.exe -v

·         Print version string:

CodeXLCpuProfiler.exe -h

·         Once the raw cpu profile data file is generated, CodeXLCpuProfiler report command can be used to generate CSV report from that raw data file:

CodeXLCpuProfiler.exe report -i c:\Temp\cpuprof-tbp.prd -o c:\Temp\cpuprof-tbp-out

 

Once the raw CPU profile data file is generated using the command line utility, the results can be viewed within CodeXL using the Import Session command in the CodeXL Explorer.