#pragma once #include #include #include namespace roro::net { // Bytes each network service has read and written since boot (S1, Q121), as the service sees // them: for TLS connections that's the plain text, without the handshake or record overhead. // Counted from the services' own tasks, read from the main loop. enum class User : uint8_t { Irc, Gemini, DebugConsole, Updates, Count }; const char* userName(User user); struct Traffic { uint32_t in = 0, out = 0; }; void received(User user, size_t bytes); void sent(User user, size_t bytes); Traffic traffic(User user); void resetTraffic(); // for tests uint32_t bytesPerSecond(uint32_t before, uint32_t now, uint32_t elapsedMs); std::string formatTraffic(uint32_t bytes); // "999 B", "1.5 KB", "12 KB", "1.7 MB" } // namespace roro::net