示例#1
0
        private void ViewerStatsHandler(Capability cap, IHttpClientContext context, IHttpRequest request, IHttpResponse response)
        {
            ViewerStatsMessage message;

            if (LLUtil.TryGetMessage <ViewerStatsMessage>(request.Body, out message))
            {
                DateTime timestamp = DateTime.UtcNow;

                if (m_statsTracker != null)
                {
                    // Log timestamped data points
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "AgentFPS", message.AgentFPS);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "AgentMemoryUsed", message.AgentMemoryUsed);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "AgentPing", message.AgentPing);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "AgentsInView", message.AgentsInView);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "FailuresInvalid", message.FailuresInvalid);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "FailuresOffCircuit", message.FailuresOffCircuit);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "FailuresResent", message.FailuresResent);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "FailuresSendPacket", message.FailuresSendPacket);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "InCompressedPackets", message.InCompressedPackets);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "InKbytes", message.InKbytes);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "InPackets", message.InPackets);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "InSavings", message.InSavings);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "MetersTraveled", message.MetersTraveled);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "MiscInt1", message.MiscInt1);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "MiscInt2", message.MiscInt2);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "MiscString1", message.MiscString1);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "MiscVersion", message.MiscVersion);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "ObjectKbytes", message.object_kbytes);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "OutCompressedPackets", message.OutCompressedPackets);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "OutKbytes", message.OutKbytes);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "OutPackets", message.OutPackets);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "OutSavings", message.OutSavings);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "RegionsVisisted", message.RegionsVisited);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "SimulatorFPS", message.SimulatorFPS);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "StatsDropped", message.StatsDropped);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "StatsFailedResends", message.StatsFailedResends);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "TextureKbytes", message.texture_kbytes);
                    m_statsTracker.LogEntry(timestamp, message.SessionID, "WorldKbytes", message.world_kbytes);

                    // Update constant values for this session
                    m_statsTracker.SetValue(message.SessionID, "AgentLanguage", message.AgentLanguage);
                    m_statsTracker.SetValue(message.SessionID, "AgentRuntime", message.AgentRuntime);
                    m_statsTracker.SetValue(message.SessionID, "AgentStartTime", message.AgentStartTime);
                    m_statsTracker.SetValue(message.SessionID, "AgentVersion", message.AgentVersion);
                    m_statsTracker.SetValue(message.SessionID, "SystemCPU", message.SystemCPU);
                    m_statsTracker.SetValue(message.SessionID, "SystemGPU", message.SystemGPU);
                    m_statsTracker.SetValue(message.SessionID, "SystemGPUClass", message.SystemGPUClass);
                    m_statsTracker.SetValue(message.SessionID, "SystemGPUVendor", message.SystemGPUVendor);
                    m_statsTracker.SetValue(message.SessionID, "SystemGPUVersion", message.SystemGPUVersion);
                    m_statsTracker.SetValue(message.SessionID, "SystemInstalledRam", message.SystemInstalledRam);
                    m_statsTracker.SetValue(message.SessionID, "SystemOS", message.SystemOS);
                    m_statsTracker.SetValue(message.SessionID, "VertexBuffersEnabled", message.VertexBuffersEnabled);
                }
            }
            else
            {
                m_log.Warn("Received invalid data for ViewerStats");
                response.Status = System.Net.HttpStatusCode.BadRequest;
            }
        }