Cell Simulator |
|
Mambo supports a simple way to start and stop simple profiling. This tutorial will go through some basics of producing profile data on a program. Before we do that, we need something to profile. If you look through Mambo's samples, provided is a matrix multiply program. Unfortunately it is 1577 lines of code. The version titled "Simple Matrix Multiple" in the code section is 167 lines. To keep this web page short, just download that file, and we will begin editting it for simple profiling. (Or just get it here.) One quick note about the program before we start on profiling, the Matrix Multiple first passes a "control block" from the PPU to the SPU. In the control block are the addresses of the Matrices to calculate. The passing of a control block (at the begining) is a "standard" way of "initializing" the SPUs. For profiling, there are three main functions:prof_clear() clears the proformance dataprof_start() starts profilingprof_end stops profiling
For out example, first include Now, before you load the linux kernel in Mambo, you must set the SPUs to be "profiledable". Just click "SPU modes" and set all of them to "Pipe". Next, load up the kernel, and run the program. (You can let the simulator run in fast mode while loading the kernel. Once, you run the program, be sure it is not in fast mode.) After the program's completion, stop the simulator (hit 'stop', or do a "ctrl-c") and then type:systemsim % mysim spu 0 display statistics
which should provide something like:
SPU DD3.0
Naturally, you can replace mysim spu 0 display statistics with another spu to see it's statistics. Furthermore, prof_clear() resets the profile data, prof_start() starts the profiling, and prof_stop() stops/suspends the profiling. (Profiling can be restarted with prof_start() .) |