Exemple #1
0
        PerfMetrics GatherPerfMetrics()
        {
            PerfMetrics metrics = new PerfMetrics();

            metrics.frameCount     = Time.frameCount;
            metrics.frameTime      = Time.unscaledTime;
            metrics.deltaFrameTime = Time.unscaledDeltaTime;

            float?floatValue;
            int?  intValue;

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.App_CpuTime_Float);
            metrics.appCpuTime_IsValid = floatValue.HasValue;
            metrics.appCpuTime         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.App_GpuTime_Float);
            metrics.appGpuTime_IsValid = floatValue.HasValue;
            metrics.appGpuTime         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.Compositor_CpuTime_Float);
            metrics.compositorCpuTime_IsValid = floatValue.HasValue;
            metrics.compositorCpuTime         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.Compositor_GpuTime_Float);
            metrics.compositorGpuTime_IsValid = floatValue.HasValue;
            metrics.compositorGpuTime         = floatValue.GetValueOrDefault();

            intValue = OVRPlugin.GetPerfMetricsInt(OVRPlugin.PerfMetrics.Compositor_DroppedFrameCount_Int);
            metrics.compositorDroppedFrameCount_IsValid = intValue.HasValue;
            metrics.compositorDroppedFrameCount         = intValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.System_GpuUtilPercentage_Float);
            metrics.systemGpuUtilPercentage_IsValid = floatValue.HasValue;
            metrics.systemGpuUtilPercentage         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.System_CpuUtilAveragePercentage_Float);
            metrics.systemCpuUtilAveragePercentage_IsValid = floatValue.HasValue;
            metrics.systemCpuUtilAveragePercentage         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.System_CpuUtilWorstPercentage_Float);
            metrics.systemCpuUtilWorstPercentage_IsValid = floatValue.HasValue;
            metrics.systemCpuUtilWorstPercentage         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.Device_CpuClockFrequencyInMHz_Float);
            metrics.deviceCpuClockFrequencyInMHz_IsValid = floatValue.HasValue;
            metrics.deviceCpuClockFrequencyInMHz         = floatValue.GetValueOrDefault();

            floatValue = OVRPlugin.GetPerfMetricsFloat(OVRPlugin.PerfMetrics.Device_GpuClockFrequencyInMHz_Float);
            metrics.deviceGpuClockFrequencyInMHz_IsValid = floatValue.HasValue;
            metrics.deviceGpuClockFrequencyInMHz         = floatValue.GetValueOrDefault();

            intValue = OVRPlugin.GetPerfMetricsInt(OVRPlugin.PerfMetrics.Device_CpuClockLevel_Int);
            metrics.deviceCpuClockLevel_IsValid = intValue.HasValue;
            metrics.deviceCpuClockLevel         = intValue.GetValueOrDefault();

            intValue = OVRPlugin.GetPerfMetricsInt(OVRPlugin.PerfMetrics.Device_GpuClockLevel_Int);
            metrics.deviceGpuClockLevel_IsValid = intValue.HasValue;
            metrics.deviceGpuClockLevel         = intValue.GetValueOrDefault();

            return(metrics);
        }