void UpdateFramerate() { timeleft -= Time.deltaTime; accum += Time.timeScale / Time.deltaTime; ++frames; // Interval ended - update GUI text and start new interval if (timeleft <= 0.0) { lastFps = accum / frames; timeleft = updateInterval; accum = 0.0F; frames = 0; if (lastFps < CognitiveVR.CognitiveVR_Preferences.Instance.LowFramerateThreshold && !lowFramerate) { lowFramerate = true; fpsTransactionID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("performance", fpsTransactionID).setProperty("fps", lastFps).begin(); Util.logDebug("low framerate"); } else if (lastFps > CognitiveVR.CognitiveVR_Preferences.Instance.LowFramerateThreshold && lowFramerate) { lowFramerate = false; Instrumentation.Transaction("performance", fpsTransactionID).end(); } } }
void UpdateHMDRotation() { rotTimeLeft -= Time.deltaTime; accumRotation += Quaternion.Angle(CognitiveVR_Manager.HMD.rotation, lastRotation) / Time.deltaTime; lastRotation = CognitiveVR_Manager.HMD.rotation; ++rotFrames; // Interval ended - update GUI text and start new interval if (rotTimeLeft <= 0.0) { lastRps = accumRotation / rotFrames; rotTimeLeft = updateInterval; accumRotation = 0.0F; rotFrames = 0; Instrumentation.Transaction("comfort", fpsTransactionID) .setProperty("fps", lastFps) .setProperty("rps", lastRps) #if CVR_OCULUS .setProperty("cpulevel", OVRPlugin.cpuLevel) .setProperty("gpulevel", OVRPlugin.gpuLevel) .setProperty("powersaving", OVRPlugin.powerSaving) #endif .beginAndEnd(); Util.logDebug("comfort fps " + lastFps + " rps " + lastRps); } }
private void OnUngripped(object sender, ClickedEventArgs e) { string transactionID; string transactionDescription = "input"; if (pendingTransactions.TryGetValue(transactionDescription, out transactionID)) { Instrumentation.Transaction(transactionDescription, transactionID).end(); pendingTransactions.Remove(transactionID); } }
void CognitiveVR_Manager_OnUpdate() { if (Vector3.SqrMagnitude(lastRootPosition - root.position) > 0.1f) { Vector3 newPosition = root.position; Instrumentation.Transaction("teleport").setProperty("distance", Vector3.Distance(newPosition, lastRootPosition)).beginAndEnd(); Util.logDebug("teleport"); lastRootPosition = root.position; } }
private void OnPadClicked(object sender, ClickedEventArgs e) { Transaction padTransaction = Instrumentation.Transaction("input"); padTransaction.setProperties(new Dictionary <string, object> { { "type", "pad" }, { "controllerindex", e.controllerIndex }, { "x", e.padX }, { "y", e.padY } }); padTransaction.beginAndEnd(); }
void CognitiveVR_Manager_OnPoseEvent(Valve.VR.EVREventType evrevent) { if (evrevent == Valve.VR.EVREventType.VREvent_TrackedDeviceUserInteractionStarted) { hmdpresentGUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("HMDPresent", hmdpresentGUID).setProperty("present", true).setProperty("starttime", Time.time).begin(); } if (evrevent == Valve.VR.EVREventType.VREvent_TrackedDeviceUserInteractionEnded) { Util.logDebug("hmd removed"); Instrumentation.Transaction("HMDPresent", hmdpresentGUID).setProperty("present", false).setProperty("endtime", Time.time - 10f).end(); } }
void OnTriggerClicked(object sender, ClickedEventArgs e) { string transactionDescription = "input"; string transactionID = System.Guid.NewGuid().ToString(); Transaction inTransaction = Instrumentation.Transaction(transactionDescription, transactionID); inTransaction.setProperty("controllerindex", e.controllerIndex).setProperty("type", "trigger"); inTransaction.begin(); if (!pendingTransactions.ContainsKey(transactionDescription)) { pendingTransactions.Add(transactionDescription, transactionID); } }
public override void CognitiveVR_Init(Error initError) { base.CognitiveVR_Init(initError); #if CVR_STEAMVR CognitiveVR_Manager.OnPoseEvent += CognitiveVR_Manager_PoseEventHandler; if (Valve.VR.OpenVR.Chaperone.AreBoundsVisible()) { chaperoneGUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("chaperone", chaperoneGUID).begin(); Util.logDebug("chaperone visible"); } #endif }
void CognitiveVR_Manager_PoseEventHandler(Valve.VR.EVREventType evrevent) { if (evrevent == Valve.VR.EVREventType.VREvent_ChaperoneDataHasChanged) { if (Valve.VR.OpenVR.Chaperone.AreBoundsVisible()) { chaperoneGUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("chaperone", chaperoneGUID).begin(); Util.logDebug("chaperone visible"); } else { Instrumentation.Transaction("chaperone", chaperoneGUID).end(); } } }
void SendBatteryLevel() { #if CVR_OCULUS Util.logDebug("batterylevel " + OVRPlugin.batteryLevel); Instrumentation.Transaction("battery") .setProperty("batterylevel", OVRPlugin.batteryLevel) .setProperty("batterytemperature", OVRPlugin.batteryTemperature) .setProperty("batterystatus", OVRPlugin.batteryStatus) .beginAndEnd(); #else if (GetBatteryLevel()) { Util.logDebug("batterylevel " + batteryLevel); Instrumentation.Transaction("battery").setProperty("batterylevel", batteryLevel).beginAndEnd(); } #endif }
private void CognitiveVR_Manager_OnTick() { if (CognitiveVR_Manager.HMD != null) { bool hit = Physics.CheckSphere(CognitiveVR_Manager.HMD.position, 0.25f, CognitiveVR_Preferences.Instance.CollisionLayerMask); if (hit && string.IsNullOrEmpty(HMDGuid)) { Util.logDebug("hmd collision"); HMDGuid = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("collision", HMDGuid).setProperty("device", "HMD").begin(); } else if (!hit && !string.IsNullOrEmpty(HMDGuid)) { Instrumentation.Transaction("collision", HMDGuid).end(); HMDGuid = string.Empty; } } }
public void SendIssue(string title, string description = null, string repro = null) { if (string.IsNullOrEmpty(title)) { return; } Transaction t = Instrumentation.Transaction("Issue").setProperty("Title", title); if (!string.IsNullOrEmpty(description)) { t.setProperty("Description", description); } if (!string.IsNullOrEmpty(repro)) { t.setProperty("Reproduction", repro); } t.beginAndEnd(); //TODO integrate with JIRA rest api }
private void CognitiveVR_Manager_OnTick() { bool hit; if (CognitiveVR_Manager.GetController(0) != null) { hit = Physics.CheckSphere(CognitiveVR_Manager.GetController(0).position, 0.25f, CognitiveVR_Preferences.Instance.CollisionLayerMask); if (hit && string.IsNullOrEmpty(controller0GUID)) { Util.logDebug("controller collision"); controller0GUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("collision", controller0GUID).setProperty("device", "controller 0").begin(); } else if (!hit && !string.IsNullOrEmpty(controller0GUID)) { Instrumentation.Transaction("collision", controller0GUID).end(); controller0GUID = string.Empty; } } if (CognitiveVR_Manager.GetController(1) != null) { hit = Physics.CheckSphere(CognitiveVR_Manager.GetController(1).position, 0.25f, CognitiveVR_Preferences.Instance.CollisionLayerMask); if (hit && string.IsNullOrEmpty(controller1GUID)) { Util.logDebug("controller collision"); controller1GUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("collision", controller1GUID).setProperty("device", "controller 1").begin(); } else if (!hit && !string.IsNullOrEmpty(controller1GUID)) { Instrumentation.Transaction("collision", controller1GUID).end(); controller1GUID = string.Empty; } } }
private void OVRManager_TrackingLost() { Instrumentation.Transaction("Tracking", hmdGUID).setProperty("Device", "HMD").setProperty("visible", false).end(); hmdGUID = string.Empty; }
private void RecenterEventTracker_RecenteredPose() { Instrumentation.Transaction("Recenter").beginAndEnd(); }
private void OVRManager_HMDMounted() { hmdpresentGUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("HMDPresent", hmdpresentGUID).setProperty("present", true).setProperty("starttime", Time.time).begin(); }
private void CognitiveVR_Manager_PoseUpdateHandler(params object[] args) { var poses = (Valve.VR.TrackedDevicePose_t[])args[0]; for (int i = 0; i < 16; i++) { if (poses.Length <= i) { break; } if (poses[i].bDeviceIsConnected && poses[i].bPoseIsValid) { bool foundMatchingDevice = false; for (int j = 0; j < Devices.Count; j++) { if (Devices[j].deviceID == i) { foundMatchingDevice = true; break; } } if (!foundMatchingDevice) { Devices.Add(new TrackedDevice() { deviceID = i }); } } } for (int j = 0; j < Devices.Count; j++) { if (!poses[Devices[j].deviceID].bPoseIsValid) { if (Devices[j].ValidTransID == string.Empty) { Devices[j].ValidTransID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("Tracking", Devices[j].ValidTransID).setProperty("deviceID", Devices[j].deviceID).setProperty("visible", false).begin(); } } else if (Devices[j].ValidTransID != string.Empty) { Instrumentation.Transaction("Tracking", Devices[j].ValidTransID).setProperty("deviceID", Devices[j].deviceID).setProperty("visible", true).end(); Devices[j].ValidTransID = string.Empty; } if (!poses[Devices[j].deviceID].bDeviceIsConnected) { if (Devices[j].ValidTransID == string.Empty) { Devices[j].ConnectedTransID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("Tracking", Devices[j].ConnectedTransID).setProperty("deviceID", Devices[j].deviceID).setProperty("connected", false).begin(); } } else if (Devices[j].ConnectedTransID != string.Empty) { Instrumentation.Transaction("Tracking", Devices[j].ConnectedTransID).setProperty("deviceID", Devices[j].deviceID).setProperty("connected", true).end(); Devices[j].ConnectedTransID = string.Empty; } } }
private void OVRManager_TrackingAcquired() { hmdGUID = System.Guid.NewGuid().ToString(); Instrumentation.Transaction("Tracking", hmdGUID).setProperty("Device", "HMD").setProperty("visible", true).begin(); }
private void OVRManager_HMDUnmounted() { Instrumentation.Transaction("HMDPresent", hmdpresentGUID).setProperty("present", false).setProperty("endtime", Time.time).end(); }