Timing

How long the calls take on a PSP, how long until their events arrive, and how fast data moves between two consoles. Measured on PSP-1000s (firmware 6.60 and 6.61) side by side, by the pspautotests net/adhoc/timing and net/adhoc/pair/timing, which print these numbers rather than check them. Medians unless a range is given.

Games get these timings without thinking about them, and many depend on them: an emulator that delivers an event much sooner or later, or blocks where the PSP returns, breaks some game.

adhocctl

Returns afterEvent after
sceNetAdhocctlInit14 ms
sceNetAdhocctlCreate30 µsCONNECT after 1.1 s
sceNetAdhocctlJoinCONNECT after 0.53 s; the creator is in the peer list after about 1.2 s
sceNetAdhocctlScan30 µsSCAN after 1.0 s, with or without groups around
sceNetAdhocctlDisconnect20 µsDISCONNECT after 105 ms
sceNetAdhocctlCreateEnterGameMode, JoinEnterGameModeGAMEMODE on all members at the same moment, once the last one has joined (3-4 s after a join a second after the create)
sceNetAdhocctlExitGameModeafter 0.64 s
sceNetAdhocctlTerm0.25 ms

The state (GetState) changes when the event is delivered, not before. sceNetAdhocctlGetParameter takes about 14 ms in a group, every call; GetState takes 0.4 µs, GetPeerList and GetScanInfo 2-6 µs.

Blocking calls and timeouts

Receives, accepts and polls with a timeout:

TimeoutWaits
1 µsreturns at once (about 8 µs)
50 or 100 µsabout 380 µs (about 420 µs for PollSocket)
500 µs and upthe timeout plus about 150 µs (190 µs for PollSocket)

sceKernelDelayThread behaves the same way (anything under about 230 µs takes 230 µs), so this is the kernel's thread wake-up granularity.

Polling has to yield. The networking threads run at the priority given to sceNetInit; a thread of the same priority that loops on non-blocking calls without ever waiting starves them, and nothing is sent or received. A wait of any length in the loop (even sceKernelDelayThread(0)) is enough.

Call costs

CallCost
PdpCreate / PdpDelete36 / 21 µs
PdpSend, non-blocking, unicast / broadcast38 / 12 µs
PdpRecv or PtpRecv, non-blocking, nothing there3.6 µs
PtpSend, non-blocking, 16 bytes184 µs
PollSocket, non-blocking23 µs
PtpOpen / PtpListen / PtpClose120 / 38 / 91 µs
GetPdpStat, GetPtpStat2-4 µs
MatchingCreate / Start / Stop / Delete93 / 580 / 530 / 22 µs
MatchingSetHelloOpt / GetHelloOpt / GetMembers27 / 7 / 1.5 µs
GameModeUpdateMaster / UpdateReplica64-98 / 7-11 µs

Between two consoles

Time
PDP round trip, 16 / 256 / 1024 / 1444 / 4096 / 8192 bytes4.1 / 4.9 / 8.0 / 9.4 / 19 / 33 ms
PTP connect (Open to established)4-8 ms
PTP round trip, 16 / 1024 / 8192 bytes6.3 / 10 / 44 ms
PtpFlush after sending 8192 bytes40 ms
Matching hellosevery hello_int, to within 2%
Matching join, SelectTarget to ESTABLISHED25 ms, plus rexmt_int for each lost packet
Matching SendData to DATA_ACK4.5 ms
Game mode: a replica changesevery 12.4 ms (6-9 ms at the shortest, 220 ms at worst), however often the master updates

PDP takes about 2 ms each way plus about 1.8 µs per byte, about 4.5 Mbit/s of payload. A PDP round trip measured with a blocking receive and with a polling loop gave the same times.