/// <summary> /// Initializes a new instance of the <see cref="UnitRunData"/> class. /// </summary> /// <param name="other">The other instance from which data will be copied.</param> protected UnitRunData(UnitRunData other) { if (other == null) { return; } UnitStartTimeStamp = other.UnitStartTimeStamp; FramesObserved = other.FramesObserved; CoreVersion = other.CoreVersion; ProjectID = other.ProjectID; ProjectRun = other.ProjectRun; ProjectClone = other.ProjectClone; ProjectGen = other.ProjectGen; WorkUnitResult = other.WorkUnitResult; FrameDataDictionary = CopyFrameData(other.FrameDataDictionary); }
private static UnitRunData GetUnitRunDataFahClient(UnitRun unitRun) { var unitRunData = new UnitRunData(); foreach (var line in unitRun.LogLines) { switch (line.LineType) { case LogLineType.WorkUnitWorking: unitRunData.UnitStartTimeStamp = line.TimeStamp; break; case LogLineType.WorkUnitFrame: if (unitRunData.UnitStartTimeStamp == null) { unitRunData.UnitStartTimeStamp = line.TimeStamp; } if (line.LineData != null) { unitRunData.FramesObserved++; } break; case LogLineType.WorkUnitCoreVersion: if (Math.Abs(unitRunData.CoreVersion) < Single.Epsilon && line.LineData != null) { unitRunData.CoreVersion = (float)line.LineData; } break; case LogLineType.WorkUnitProject: unitRunData.ProjectInfoList.Add((IProjectInfo)line.LineData); break; case LogLineType.WorkUnitCoreReturn: unitRunData.WorkUnitResult = (WorkUnitResult)line.LineData; break; } } return(unitRunData); }
private static UnitRunData GetUnitRunDataLegacy(UnitRun unitRun) { bool clientWasPaused = false; bool lookForProject = true; var unitRunData = new UnitRunData(); foreach (var line in unitRun.LogLines) { #region Unit Start if ((line.LineType == LogLineType.WorkUnitProcessing || line.LineType == LogLineType.WorkUnitWorking || line.LineType == LogLineType.WorkUnitStart || line.LineType == LogLineType.WorkUnitFrame) && unitRunData.UnitStartTimeStamp == null) { unitRunData.UnitStartTimeStamp = LogLineParser.Common.GetTimeStamp(line); } if (line.LineType == LogLineType.WorkUnitPaused || line.LineType == LogLineType.WorkUnitPausedForBattery) { clientWasPaused = true; } else if ((line.LineType == LogLineType.WorkUnitWorking || line.LineType == LogLineType.WorkUnitResumeFromBattery || line.LineType == LogLineType.WorkUnitFrame) && clientWasPaused) { clientWasPaused = false; // Reset the Frames Observed Count // This will cause the Instance to only use frames beyond this point to // set frame times and determine status - Issue 13 (Revised) unitRunData.FramesObserved = 0; // Reset the Unit Start Time unitRunData.UnitStartTimeStamp = LogLineParser.Common.GetTimeStamp(line); } #endregion #region Project if (lookForProject) { // If we encounter a work unit frame, we should have // already seen the Project Information, stop looking if (line.LineType == LogLineType.WorkUnitFrame) { lookForProject = false; } if (line.LineType == LogLineType.WorkUnitProject) { if (line.LineData != null) { unitRunData.ProjectInfoList.Add((IProjectInfo)line.LineData); } } } #endregion switch (line.LineType) { case LogLineType.WorkUnitFrame: if (line.LineData != null) { unitRunData.FramesObserved++; } break; case LogLineType.WorkUnitCoreVersion: if (Math.Abs(unitRunData.CoreVersion) < Single.Epsilon && line.LineData != null) { unitRunData.CoreVersion = (float)line.LineData; } break; case LogLineType.WorkUnitCoreShutdown: case LogLineType.ClientCoreCommunicationsError: unitRunData.WorkUnitResult = (WorkUnitResult)line.LineData; break; case LogLineType.WorkUnitCallingCore: unitRunData.Threads = (int)line.LineData; break; case LogLineType.ClientNumberOfUnitsCompleted: unitRunData.TotalCompletedUnits = (int)line.LineData; break; } } return(unitRunData); }