Home
Cycles-Per-Instruction Measurement
CPI: Measure CPI for application or time interval
Syntax:
cpi <-? | -??> (** HELP MODE)
<free_options> <-s #> <-c command> (** COMMAND MODE)
<free_options> (** MANUAL START/STOP MODE)
<free_options> <-s #> <-r #> (** AUTO START/STOP MODE)
free_options: <-noai> <-t sec> <-f fn> <-ds> <-ts>
- Any combination of these options can be used in all modes.
Where:
********** FREE OPTIONS **********
-noai Causes cpi not to measure CPU utilization.
* idle and busy values are not displayed.
* cpi_wb (CPI while busy) is not calculated.
-t #sec Specifies a sampling interval (in seconds).
cpi will calculate and display CPI for each interval.
* If you set the interval too short you will affect the very
same CPI you are trying to measure.
* If you DO NOT specify the -t option, CPI will be calculated
and displayed either:
- When CPI measurement is stopped (via ENTER or Ctrl-C).
- When the user command being measured completes.
- When the specified run time has completed.
-f fn Specifies a filename to write results to.
cpi will write all output to the STDOUT and to the output file.
* If you DO NOT specify the -f option, all output is to STDOUT.
-ds Display system summary CPI only. Do not display per-processor CPI.
* The resulting output is more compact - one line per sample instead
of five (5) when displaying per-processor CPI.
* If you DO NOT specify the -ds option, the results include the
system and per-processor CPI values.
-ts Timestamp each CPI sample.
* Useful when trying to correlate CPI output to other events which
have time associated with them.
* If you DO NOT specify the -ts option, the results do not include
the time at which they were calculated.
********** COMMAND/START/STOP OPTIONS **********
-s #sec Causes cpi to automatically start measuring CPU utilization
after approximately #sec seconds.
* You WILL NOT be prompted for when to start measuring. Instead,
measuring will start automatically after a delay of about
#sec seconds.
* If you specify 0 (zero), measuring starts immediately.
* If you use this option your application should be started and
warmed up by the time measuring is started.
* If you DO NOT specify the -s option, you WILL BE prompted
for when to start the measurement interval.
-r #sec Run (measure) for approximately #sec seconds then stop.
* You WILL NOT be prompted for when to stop measuring. Instead,
measuring will stop automatically after a delay of about
#sec seconds from the time measuring was started.
* If you specify 0 (zero), measuring is stopped immediately after
being started. Kind of useless.
* If you use this option your application should complete the
scenario you want to measure in approximately the amount of
time you specify with this option.
* NOT allowed with -c.
* If you DO NOT specify the -r option, you will be prompted for
when to stop measuring.
-c Causes cpi to execute the requested command and measure CPI, and
optionally, CPU utilization while the command executes.
* If specified, -c must be the last or only option entered.
* -c and -r are mutually exclusive options.
- The entire command execution is measured. You can't specify
a run time.
* 'command' must be a .EXE, .CMD or .BAT file. It can't be an
internal Windows command such as "dir".
- If the command contains blanks then enclose the entire
command in double quotes. For example:
-c "java GraphSuite drawLine native=p6 speed=500"
- If the command contains double quotes then enclose the entire
command in double quotes *AND* use the \" escape sequence
(backslash-double quote) for the inner double quotes.
For example, if your command is:
java Translate "Hello World!" lang=ES
Your -c option would look like:
-c "java Translate \"Hello World!\" lang=ES"
- If you want to redirect your application's output then you
*MUST* invoke it from a .CMD or .BAT file.
Notes:
* At this time you cannot specify -r with -c.
* idle and busy are not displayed if the -noai option is specified.
* If you specify a command then the measured CPI will include application
load and termination.
* Applications are launched in their own window. If you want to run the
application without opening a new window then use -cc instead of -c.
- Be aware that you can't sample (specify -t) if you use -cc.
* Results will be invalid if the scenario to be measured executes more than
(2**40)-1 (1,099,511,627,775) instructions. Performance counters are 40-bit
and, if the counter value wraps, there is no way to tell how many times
the counter wrapped.
* Every now and then you may see an incomplete display line at the end of
the measurement interval (either because automatically stopped or because
stopped via Ctrl-C). I haven't figured out how to cleanly interrupt the
sampling thread. I'll work on that ...
Valid Commands:
1) cpi
* Prompts user for when to start measurement interval.
* Prompts user for when to end measurement interval.
* Measures CPI and CPU utilization for the interval.
2) cpi -s 10
* Automatically starts measurement interval in about 10 seconds.
* Prompts user for when to end measurement interval.
* Measures CPI and CPU utilization for the interval.
3) cpi -s 10 -t 2
* Automatically starts measurement interval in about 10 seconds.
* Prompts user for when to end measurement interval.
* Measures and displays CPI and CPU utilization every 2 seconds.
4) cpi -s 10 -r 20
* Automatically start the measurement interval in about 10 seconds.
* Runs measurement interval for about 20 seconds and automatically
stops it.
* Measures CPI and CPU utilization for the interval.
* There are no user prompts.
5) cpi -s 10 -r 20 -t 2
* Automatically start the measurement interval in about 10 seconds.
* Runs measurement interval for about 20 seconds and automatically
stops it.
* Measures and displays CPI and CPU utilization every 2 seconds.
* There are no user prompts.
6) cpi -r 20
* Prompts user for when to start measurement interval.
* Runs measurement interval for about 20 seconds after being started
and automatically stops it.
* Measures CPI and CPU utilization for the interval.
7) cpi -s 0 -r 20
* Immediately start the measurement interval (in about 0 seconds).
* Runs measurement interval for about 20 seconds and automatically
stops it.
* Measures CPI and CPU utilization for the interval.
* There are no user prompts.
8) cpi -s 0 -r 20 -t 2
* Immediately start the measurement interval (in about 0 seconds).
* Runs measurement interval for about 20 seconds and automatically
stops it.
* Measures and displays CPI and CPU utilization every 2 seconds.
* There are no user prompts.
9) cpi -c "java java_app"
* Runs command 'java java_app' and measures CPI and CPU utilization
for the duration of the command.
* The command runs in a new window.
10) cpi -cc "java java_app"
* Same as #9 but the command runs in the current window.
11) cpi -t 2 -c "java java_app"
* Runs command 'java java_app' and measures CPI and CPU utilization
every 2 seconds for the duration of the command.
* The command runs in a new window.
12) cpi -s 10 -c "java java_app"
* Automatically starts the command 'java java_app', and starts the
measurement interval in about 10 seconds.
* Runs command and measures CPI and CPU utilization for the duration
of the command.
* The command runs in a new window.
13) cpi -s 10 -t 2 -c "java java_app"
* Automatically starts the command 'java java_app', and starts the
measurement interval in about 10 seconds.
* Measures and displays CPI and CPU utilization every 2 seconds for
the duration of the command.
* The command runs in a new window.
Sample Output:
1) System at almost 100% idle:
System CPU0 CPU1 CPU2 CPU3
cpi 943.27 909.18 728.15 1426.35 937.87
cpi_wb 7.55 8.71 5.90 8.39 7.92
idle% 99.20 99.04 99.19 99.41 99.16
busy% 0.80 0.96 0.81 0.58 0.84
2) System at almost 100% busy:
System CPU0 CPU1 CPU2 CPU3
cpi 1.26 1.32 1.22 1.31 1.21
cpi_wb 1.25 1.30 1.20 1.29 1.20
idle% 1.10 1.18 1.28 0.89 1.04
busy% 98.90 98.82 98.72 99.11 98.96
3) System at about 50% busy:
System CPU0 CPU1 CPU2 CPU3
cpi 2.96 3.47 2.67 2.77 3.07
cpi_wb 1.48 2.33 1.02 1.16 1.60
idle% 50.10 32.71 61.88 58.08 47.73
busy% 49.90 67.29 38.12 41.92 51.04
4) System at almost 100% busy, system CPI summary:
cpi: 1.23 cpi_wb: 1.21 idle: 1.26% busy: 98.74%
cpi: 1.25 cpi_wb: 1.24 idle: 1.36% busy: 98.64%
cpi: 1.21 cpi_wb: 1.20 idle: 1.22% busy: 98.78%
cpi: 1.24 cpi_wb: 1.23 idle: 1.06% busy: 98.94%
Sample Output Description:
* All values are measured for either:
- The entire measurement interval.
- One sampling interval.
* 'total_busy' is a computed value indicating the total % busy.
- For a CPU, 'total_busy' is the total time the CPU is not idle.
- For the system, 'total_busy' is the total time the system is not idle.
- 'total_busy' includes interrupt time.
* 'System' values are averages over all CPUs.
* 'CPUx' values are per-cpu.
* 'cpi' is measured Cycles-Per-Instructions (cycles / instructions).
* 'cpi_wb' is Cycles-Per-Instruction While Busy (cpi * total_busy / 100).
* 'idle' and 'busy' are the % of time the system was either idle or busy.
* Calculations:
- Per-CPU
cpi: interval_cycles / interval_instr
cpi_wb: cpu_cpi * total_busy / 100
idle%: interval_idle_cycles / interval_cycles * 100
busy%: interval_busy_cycles / interval_cycles * 100
- System
cpi: sum(cpu_cycles) / sum(cpu_instr)
cpi_wb: sum((cpu_cycles * total_busy / 100)) / sum(instr)
idle%: sum(cpu_idle_cycles) / sum(cpu_cycles) * 100
busy%: sum(cpu_busy_cycles) / sum(cpu_cycles) * 100
Home