group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
group2::perf::shotlog Namespace Reference

Classes

struct  ShotResolution
 Per-shot record for the server-side shot-resolution log. More...

Functions

void openIfRequested ()
 Open the log file from GROUP2_SERVER_SHOTS_CSV if set, write the CSV header, and remember the FILE* for subsequent recordShotResolution calls.
void recordShotResolution (const ShotResolution &shot)
 Append one shot-resolution row.
void close () noexcept
 Flush + close the log file. Called from ServerGame::shutdown.

Variables

constexpr std::uint16_t k_missClientId = 0xFFFFu
 Sentinel hitClientId value meaning "shot missed all targets".

Function Documentation

◆ close()

void group2::perf::shotlog::close ( )
noexcept

Flush + close the log file. Called from ServerGame::shutdown.

Here is the caller graph for this function:

◆ openIfRequested()

void group2::perf::shotlog::openIfRequested ( )

Open the log file from GROUP2_SERVER_SHOTS_CSV if set, write the CSV header, and remember the FILE* for subsequent recordShotResolution calls.

Idempotent — second call is a no-op so callers don't need to gate on first-init.

Here is the caller graph for this function:

◆ recordShotResolution()

void group2::perf::shotlog::recordShotResolution ( const ShotResolution & shot)

Append one shot-resolution row.

Thread-safe — the implementation guards the file with an internal mutex so multiple game-thread weapon-system call sites can write without colliding. No-op when the log isn't open (env var unset, or open failed).

Here is the caller graph for this function:

Variable Documentation

◆ k_missClientId

std::uint16_t group2::perf::shotlog::k_missClientId = 0xFFFFu
inlineconstexpr

Sentinel hitClientId value meaning "shot missed all targets".

We use 0xFFFF instead of 0 because ClientId 0 is a legitimate connected client (the first one to join).