Example #1
0
void C4Network2Stats::ExecuteSecond() {
  statFPS.RecordValue(C4Graph::ValueType(Game.FPS));
  statNetI.RecordValue(
      C4Graph::ValueType(Game.Network.NetIO.getProtIRate(P_TCP) +
                         Game.Network.NetIO.getProtIRate(P_UDP)));
  statNetO.RecordValue(
      C4Graph::ValueType(Game.Network.NetIO.getProtORate(P_TCP) +
                         Game.Network.NetIO.getProtORate(P_UDP)));
  // pings for all clients
  C4Network2Client *pClient = NULL;
  while (pClient = Game.Network.Clients.GetNextClient(pClient))
    if (pClient->getStatPing()) {
      int iPing = 0;
      C4Network2IOConnection *pConn = pClient->getMsgConn();
      if (pConn) iPing = pConn->getLag();
      pClient->getStatPing()->RecordValue(C4Graph::ValueType(iPing));
    }
  ++SecondCounter;
}