예제 #1
0
        public string ToJSON()
        {
            OVRSimpleJSON.JSONObject jsonNode = new OVRSimpleJSON.JSONObject();
            jsonNode.Add("frameCount", new OVRSimpleJSON.JSONNumber(frameCount));
            jsonNode.Add("frameTime", new OVRSimpleJSON.JSONNumber(frameTime));
            jsonNode.Add("deltaFrameTime", new OVRSimpleJSON.JSONNumber(deltaFrameTime));
            if (appCpuTime_IsValid)
            {
                jsonNode.Add("appCpuTime", new OVRSimpleJSON.JSONNumber(appCpuTime));
            }
            if (appGpuTime_IsValid)
            {
                jsonNode.Add("appGpuTime", new OVRSimpleJSON.JSONNumber(appGpuTime));
            }
            if (compositorCpuTime_IsValid)
            {
                jsonNode.Add("compositorCpuTime", new OVRSimpleJSON.JSONNumber(compositorCpuTime));
            }
            if (compositorGpuTime_IsValid)
            {
                jsonNode.Add("compositorGpuTime", new OVRSimpleJSON.JSONNumber(compositorGpuTime));
            }
            if (compositorDroppedFrameCount_IsValid)
            {
                jsonNode.Add("compositorDroppedFrameCount", new OVRSimpleJSON.JSONNumber(compositorDroppedFrameCount));
            }
            if (systemGpuUtilPercentage_IsValid)
            {
                jsonNode.Add("systemGpuUtilPercentage", new OVRSimpleJSON.JSONNumber(systemGpuUtilPercentage));
            }
            if (systemCpuUtilAveragePercentage_IsValid)
            {
                jsonNode.Add("systemCpuUtilAveragePercentage", new OVRSimpleJSON.JSONNumber(systemCpuUtilAveragePercentage));
            }
            if (systemCpuUtilWorstPercentage_IsValid)
            {
                jsonNode.Add("systemCpuUtilWorstPercentage", new OVRSimpleJSON.JSONNumber(systemCpuUtilWorstPercentage));
            }
            if (deviceCpuClockFrequencyInMHz_IsValid)
            {
                jsonNode.Add("deviceCpuClockFrequencyInMHz", new OVRSimpleJSON.JSONNumber(deviceCpuClockFrequencyInMHz));
            }
            if (deviceGpuClockFrequencyInMHz_IsValid)
            {
                jsonNode.Add("deviceGpuClockFrequencyInMHz", new OVRSimpleJSON.JSONNumber(deviceGpuClockFrequencyInMHz));
            }
            if (deviceCpuClockLevel_IsValid)
            {
                jsonNode.Add("deviceCpuClockLevel", new OVRSimpleJSON.JSONNumber(deviceCpuClockLevel));
            }
            if (deviceGpuClockLevel_IsValid)
            {
                jsonNode.Add("deviceGpuClockLevel", new OVRSimpleJSON.JSONNumber(deviceGpuClockLevel));
            }
            string str = jsonNode.ToString();

            return(str);
        }
예제 #2
0
 public bool LoadFromJSON(string json)
 {
     OVRSimpleJSON.JSONObject jsonNode = OVRSimpleJSON.JSONObject.Parse(json) as OVRSimpleJSON.JSONObject;
     if (jsonNode == null)
     {
         return(false);
     }
     frameCount                             = jsonNode["frameCount"] != null ? jsonNode["frameCount"].AsInt : 0;
     frameTime                              = jsonNode["frameTime"] != null ? jsonNode["frameTime"].AsFloat : 0;
     deltaFrameTime                         = jsonNode["deltaFrameTime"] != null ? jsonNode["deltaFrameTime"].AsFloat : 0;
     appCpuTime_IsValid                     = jsonNode["appCpuTime"] != null;
     appCpuTime                             = appCpuTime_IsValid ? jsonNode["appCpuTime"].AsFloat : 0;
     appGpuTime_IsValid                     = jsonNode["appGpuTime"] != null;
     appGpuTime                             = appGpuTime_IsValid ? jsonNode["appGpuTime"].AsFloat : 0;
     compositorCpuTime_IsValid              = jsonNode["compositorCpuTime"] != null;
     compositorCpuTime                      = compositorCpuTime_IsValid ? jsonNode["compositorCpuTime"].AsFloat : 0;
     compositorGpuTime_IsValid              = jsonNode["compositorGpuTime"] != null;
     compositorGpuTime                      = compositorGpuTime_IsValid ? jsonNode["compositorGpuTime"].AsFloat : 0;
     compositorDroppedFrameCount_IsValid    = jsonNode["compositorDroppedFrameCount"] != null;
     compositorDroppedFrameCount            = compositorDroppedFrameCount_IsValid ? jsonNode["ompositorDroppedFrameCount"].AsInt : 0;
     systemGpuUtilPercentage_IsValid        = jsonNode["systemGpuUtilPercentage"] != null;
     systemGpuUtilPercentage                = systemGpuUtilPercentage_IsValid ? jsonNode["systemGpuUtilPercentage"].AsFloat : 0;
     systemCpuUtilAveragePercentage_IsValid = jsonNode["systemCpuUtilAveragePercentage"] != null;
     systemCpuUtilAveragePercentage         = systemCpuUtilAveragePercentage_IsValid ? jsonNode["systemCpuUtilAveragePercentage"].AsFloat : 0;
     systemCpuUtilWorstPercentage_IsValid   = jsonNode["systemCpuUtilWorstPercentage"] != null;
     systemCpuUtilWorstPercentage           = systemCpuUtilWorstPercentage_IsValid ? jsonNode["systemCpuUtilWorstPercentage"].AsFloat : 0;
     deviceCpuClockFrequencyInMHz_IsValid   = jsonNode["deviceCpuClockFrequencyInMHz"] != null;
     deviceCpuClockFrequencyInMHz           = deviceCpuClockFrequencyInMHz_IsValid ? jsonNode["deviceCpuClockFrequencyInMHz"].AsFloat : 0;
     deviceGpuClockFrequencyInMHz_IsValid   = jsonNode["deviceGpuClockFrequencyInMHz"] != null;
     deviceGpuClockFrequencyInMHz           = deviceGpuClockFrequencyInMHz_IsValid ? jsonNode["deviceGpuClockFrequencyInMHz"].AsFloat : 0;
     deviceCpuClockLevel_IsValid            = jsonNode["deviceCpuClockLevel"] != null;
     deviceCpuClockLevel                    = deviceCpuClockLevel_IsValid ? jsonNode["deviceCpuClockLevel"].AsInt : 0;
     deviceGpuClockLevel_IsValid            = jsonNode["deviceGpuClockLevel"] != null;
     deviceGpuClockLevel                    = deviceGpuClockLevel_IsValid ? jsonNode["deviceGpuClockLevel"].AsInt : 0;
     return(true);
 }