CTR Pia  4.11.3
Game Communication Engine
SyncProtocol Validation Testing (SyncProtocol Profiling)

Introduction

This test program is for profiling the CPU load of the SyncProtocol class of PiaSync. It is essentially identical to the sync/SyncProtocol Sample Demo demo, with additional code for measuring the CPU load.

After the program starts, it measures the CPU load in an idle state (nothing is drawn on the screen) and when no communication is taking place. (Only the text "Profiling..." appears.) It then transitions to the Mode Selection screen. As with the sync/SyncProtocol Sample Demo sample, start synchronization with the target settings, press the L Button to profile for 10 seconds, and then output the results to the console.

Process Overview and Controls

Mode Selection Screen

Select the communication mode from this screen. Select to perform matchmaking (automatch), and then go to the Main screen.

Input

Operation

A Button Run local communication (UDS library) as a host. After you successfully create a session, you transition to the Synchronized Data Selection screen.
B Button Run local communication (UDS) as a client. Search for UDS networks, join the one that is found, and then transition to the Synchronized Data Selection screen. If you press START during a search for UDS networks, you cancel the search and return to the Mode Selection screen.
X Button Run in the mode that uses Internet communication. Matchmaking occurs automatically. If there is a matchmaking target, you join as a client. If there is no matchmaking target, you create a session as the host. You next transition to the Synchronized Data Selection screen.
START Exits the program.

Synchronized Data Selection Screen

On this screen, you select the data that the local station sends during synchronized communication.

This screen appears if the SyncProtocol::State is NOT_SYNCHRONIZED.

Input Operation
Up/down on the +Control Pad Moves the cursor.
Left/right on the +Control Pad Selects whether to send the item that the cursor is currently over.
A Button Call SyncProtocol::Start with the specified settings as arguments, and start synchronized communication. When communication starts, the program transitions to the Main screen.
START Withdraws from the session and returns to the Mode Selection screen.

When a session cannot continue because of an error or another reason, you are automatically returned to the Mode Selection screen.

Main Screen

Performs synchronized communication using SyncProtocol.

The data sent by using synchronized communication appears on the screen. A value appears for items selected for synchronized communication. Items that were not selected are blank.

Input Operation
R Button Calls SyncProtocol::End, and ends synchronized communication. After communication ends, the program returns to the Synchronized Data Selection screen.
L Button Starts the CPU load meter.
START Withdraws from the session and returns to the Mode Selection screen.

During measurement, only the string "Profiling..." appears on the screen. After 10 seconds of measurement, the program prints the results to the console, and then returns to the Main screen.

If synchronized communication is stopped during measurement for any reason, the measurement results will be incorrect. (In some cases, no measurement results are displayed.) If you restart synchronization from this state and begin profiling, incorrect results may appear. When this happens, try restarting the application.

When a session cannot continue because of an error or another reason, you are automatically returned to the Mode Selection screen.

Viewing the Measurement Results

The profiling settings are shown in a block as follows.

******** Profiling Setting ********
...
***********************************


The block that appears when building the session displays the static settings and the block that appears with each measurement displays the temporary state. Refer to both blocks.

Of these, the settings directly related to SyncProtocol are in the static settings.

SyncProtocol::Setting::m_DataUnitSize : 12 6 8 0 0 0 0 0
SyncProtocol::Setting::m_Delay : 5
SyncProtocol::Setting::m_TimeoutFrame : 240
SyncProtocol::Setting::m_SendPeriod : 1

The following settings are specified in the call to the SyncProtocol::Initialize function. These settings are in a temporary state. During the profiling, they are the UsingDataIdBitmap values for each station.

UsingDataIdBitmap : 07 07 07 07

The results are displayed as follows.

-- Profiler --
PiaSession StationNum: 4
Idle Profile Result: 9916 (10000 [ms], 9916)
Base Profile Result: 9585 (10000 [ms], 9585)
Target Profile Result: 9258 (10000 [ms], 9258)
Profile Result: 3.30 %
...
profile frame : 300

The result "Profile Result: 3.30 %" means that Pia library processing and application processing relating to the Pia library was 3.30% of CPU capacity when using SyncProtocol.

"profile frame: 300" is the number of frames advanced during the profiling period. Because profiling occurs at 30 fps for 10 seconds, the expected value is 300. If the number is lower than 300, it means that some frames were dropped while waiting for synchronization. If a frame is dropped, the program skips that frame without doing any processing, reducing the measured CPU load by that amount. Take this into account when interpreting the results.