7 Performance

In this section we add a sequence playback and performance meter to nu2, and indicate how to make efficient use of a triple frame buffer.

We also explain task division.

The source can be found in the nu5 directory below the sample directory.


7.1 Triple Frame Buffer

Upon execution, the stage number, frame buffer mode (double or triple), and frame/second rate is displayed in the upper left corner of the screen.

It displays the performance meter vertically on the screen.

From top to botton, the performance meter shows the audio task processing time, the RSP graphics task processing time, and the RDP processing time.

The performance meter can be displayed with the following function.

nuDebTaskPerfBar0(1,200,NU_SC_NOSWAPBUFFER);

In the same way, the debug console can use this function internally to set the RDP and to create a display list and activate a graphics task.

(Be careful that the function is only inserted into the libnusys_d.a debug library.)

Only one square shape appears on the screen, but the graphic spans around 1.2 frames because it comprises a stack of 25 overlaid drawings.

If you push the Z trigger here, the mode changes to triple frame buffer mode.

The number of frames processed per second increases a little and, at the same time, the timing of task starts changes significantly.

Pressing the Z trigger in 3 frame buffer mode provides continuous RCP task processing.


7.2 Graphic Task Division

Pushing the START button swaps to stage 1.

In stage 1, graphic processes are divided into a screen clearing process and a drawing process.

Clearing the screen takes a long time in an RDP process. So instead of running the process as a single task, you can clear the screen as a separate task and thereby slightly increase the RSP's free time.

If the display list gets long for functions other than clearing the screen, dividing tasks provides efficient RSP usage.