Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1090,15 +1090,57 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 1089 unmodified lines | |||
| 1090 | 1090 | ||
| 1091 | // Add periodic checks to send user activity data | 1091 | // Add periodic checks to send user activity data |
| 1092 | static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000; | 1092 | static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000; |
| 1093 | static int SEND_FPS_INTERVAL_MS = 10000; | 1093 | static int SEND_STATS_INTERVAL_MS = 10000; |
| 1094 | static int NEARBY_AVATAR_RADIUS_METERS = 10; | ||
| 1094 | 1095 | ||
| 1095 | // Periodically send fps as a user activity event | 1096 | // Periodically send fps as a user activity event |
| 1096 | QTimer* sendFPSTimer = new QTimer(this); | 1097 | QTimer* sendStatsTimer = new QTimer(this); |
| 1097 | sendFPSTimer->setInterval(SEND_FPS_INTERVAL_MS); | 1098 | sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS); |
| 1098 | connect(sendFPSTimer, &QTimer::timeout, this, [this]() { | 1099 | connect(sendStatsTimer, &QTimer::timeout, this, [this]() { |
| 1099 | UserActivityLogger::getInstance().logAction("fps", { { "rate", _frameCounter.rate() } }); | 1100 | QJsonObject properties = {}; |
| 1101 | MemoryInfo memInfo; | ||
| 1102 | if (getMemoryInfo(memInfo)) { | ||
| 1103 | properties["system_memory_total"] = static_cast<int64_t>(memInfo.totalMemoryBytes); | ||
| 1104 | properties["system_memory_used"] = static_cast<int64_t>(memInfo.usedMemoryBytes); | ||
| 1105 | properties["process_memory_used"] = static_cast<int64_t>(memInfo.processUsedMemoryBytes); | ||
| 1106 | } | ||
| 1107 | |||
| 1108 | auto displayPlugin = qApp->getActiveDisplayPlugin(); | ||
| 1109 | |||
| 1110 | properties["fps"] = _frameCounter.rate(); | ||
| 1111 | properties["present_rate"] = displayPlugin->presentRate(); | ||
| 1112 | properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate(); | ||
| 1113 | properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate(); | ||
| 1114 | properties["sim_rate"] = getAverageSimsPerSecond(); | ||
| 1115 | properties["avatar_sim_rate"] = getAvatarSimrate(); | ||
| 1116 | |||
| 1117 | auto bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); | ||
| 1118 | properties["packet_rate_in"] = bandwidthRecorder->getCachedTotalAverageInputPacketsPerSecond(); | ||
| 1119 | properties["packet_rate_out"] = bandwidthRecorder->getCachedTotalAverageOutputPacketsPerSecond(); | ||
| 1120 | properties["kbps_in"] = bandwidthRecorder->getCachedTotalAverageInputKilobitsPerSecond(); | ||
| 1121 | properties["kbps_out"] = bandwidthRecorder->getCachedTotalAverageOutputKilobitsPerSecond(); | ||
| 1122 | |||
| 1123 | auto nodeList = DependencyManager::get<NodeList>(); | ||
| 1124 | SharedNodePointer entityServerNode = nodeList->soloNodeOfType(NodeType::EntityServer); | ||
| 1125 | SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer); | ||
| 1126 | SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer); | ||
| 1127 | SharedNodePointer assetServerNode = nodeList->soloNodeOfType(NodeType::AssetServer); | ||
| 1128 | SharedNodePointer messagesMixerNode = nodeList->soloNodeOfType(NodeType::MessagesMixer); | ||
| 1129 | properties["entity_ping"] = entityServerNode ? entityServerNode->getPingMs() : -1; | ||
| 1130 | properties["audio_ping"] = audioMixerNode ? audioMixerNode->getPingMs() : -1; | ||
| 1131 | properties["avatar_ping"] = avatarMixerNode ? avatarMixerNode->getPingMs() : -1; | ||
| 1132 | properties["asset_ping"] = assetServerNode ? assetServerNode->getPingMs() : -1; | ||
| 1133 | properties["messages_ping"] = messagesMixerNode ? messagesMixerNode->getPingMs() : -1; | ||
| 1134 | |||
| 1135 | auto loadingRequests = ResourceCache::getLoadingRequests(); | ||
| 1136 | properties["active_downloads"] = loadingRequests.size(); | ||
| 1137 | properties["pending_downloads"] = ResourceCache::getPendingRequestCount(); | ||
| 1138 | |||
| 1139 | properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false; | ||
| 1140 | |||
| 1141 | UserActivityLogger::getInstance().logAction("stats", properties); | ||
| 1100 | }); | 1142 | }); |
| 1101 | sendFPSTimer->start(); | 1143 | sendStatsTimer->start(); |
| 1102 | 1144 | ||
| 1103 | 1145 | ||
| 1104 | // Periodically check for count of nearby avatars | 1146 | // Periodically check for count of nearby avatars |