How to calculate the CPI using Shade Tool?
Hi,
I have Sparc V9 machine and I have installed the Shade tool on it. I have written simple C programs like matrix multiplication to analyze using Shade.
For example, I use the ifreq command and it gives me the list and frequency of the instructions executed.
I am trying to calculate the CPI = cycles per instruction. Is it possible using the shade tool? Please let me know what command to use.
Thank you for the help.
Best regards
Raghudeep Kannavara
[497 byte] By [
Raghudeep] at [2007-11-26 11:16:59]

# 1
Hi,
Shade is not the appropriate tool for calculating cycle counts. It's great for working out instruction counts, or digging into what happens during the execution of the program. Shade basically instruments the program, so the runtime of the program under Shade is significantly different from the normal runtime.
If you're interested in looking at the application as it runs - finding out hot spots, and CPI etc, then I'd suggest that you try using spot (together with Sun Studio 11) instead:
http://cooltools.sunsource.net/spot/
spot runs the target application a number of times under various 'probes' and produces an html report on where the application spends the time.
Regards,
Darryl.
# 2
Hi there,
I wanted to infrom u one thing that simply calculating CPI or later MIPS does'nt work . U guys have to compare with a bench mark program which has already been running on other processor. Compare the execution time that makes sense. instead if u guys compare the CPI u have to consider the clock width. If u guys are comparing the MIPS(old processor can give better result depending on the compiler) it can give better mips . Consider an example :consider a clock of 1ghz
IF there r 1 add instruction in a program which is being implemented by 2 different compliers to two different processors with different ISA then it may so happen that.
1st program:old processor
CPIPercentage of occurance CPIeffective
NOP1x50%0.5
ADD2x50%1
+1.5
Mips rating of program 1=666MIPs
2nd program:new processor
Add2100%
Mips rating of program 2=1/2=500MIPs
Instead if u calculate the execution time then u can know the real performance :Execution time of program 1:=instruction count/MIPS =1ns+2ns=3ns
Execution time of program 2 =Instruction count /MIPs=2ns
Hence u can see the difference.
# 3
> I am trying to calculate the CPI = cycles per
> instruction. Is it possible using the shade tool?
> Please let me know what command to use.
I suggest the following:
1. Use the shade utility 'icount' to count the number of instructions executed by your program.
2. Use the unix utility 'time' (/bin/time) to measure the execution time of your program in seconds.
3. Get the cycle count of your program by multiplying execution time with cpu frequency.
4. Divide cycle count by instruction count to get CPI.
Here is an example:
% icount -- sieve 20000
looking for first 20000 primes
20000 prime = 224737
Total instructions: 14783697022
% /bin/time sieve 20000
looking for first 20000 primes
20000 prime = 224737
real12.4
user12.0
sys 0.0
========= Calculation ============
Cycle count = (user time) * frequency
= 12.0 * 1200000000/* 1.2 GHz cpu */
= 14.4 billion
CPI = 14.4 billion /14783697022
= 0.974
===============================
Shade only analyzes non kernel content. So the above procedure cannot be used to obtain kernel CPI, but it should work fine for programs such as matrix multiplication and the like.
Hope this helps.
Rabin
# 4
Hi,
I am trying to use the Spot tool and I get the following error when I use it.
When I use the command:
> cc -g -O -xbinopt=prepare -o qsort3 qsort3.c
I get the following warning, but dosent report any errors:
cc: Warning: illegal option -xbinopt=prepare
When I use this command
> spot -X qsort3
I get the following output:
Collect machine statistics
Collect application details
Collect ipc data using ripc
Collect data using BIT
Output ifreq data from bit
Collect bandwidth data
Collect traps data
Collect HW counter profile data
Generating html output for HW counter profile data
Collect clock-based profiling data
Unrecognized argument -O
Generating html output for time profile data
Done collecting, tidying up reports
It says "Unrecognized argument -O" and all the generated reports are empty.
>In messages.html.txt
Nov 16 05:58:26 itrisun sshd[921]: [ID 800047 auth.error] error: Could
not get shadow information for NOUSER
Nov 16 13:29:12 itrisun su: [ID 810491 auth.crit] 'su root' failed for
shollen on /dev/pts/4
Nov 16 13:29:21 itrisun last message repeated 1 time
>In bit.log
postopt: error: Can't operate on /usr/local1/w112rxk/shade/a.out, please
recompile with -xbinopt=prepare flag
If -xbinopt=prepare has been used properly, and the error
message(s) above from bit are not helpful enough, the file
./spot_run9/debug.log
may contain more information about this section
(search for the word bit in the debug.log file).
Please let me know how to run the spot tool to collect the information and get rid of the above errors.
Thank you for the help.
Regards
Raghudeep Kannavara
