コード例 #1
0
            internal static void CalculateFrameDataDuration(LogLineFrameData frameData, IDictionary <int, LogLineFrameData> frames)
            {
                int previousFrameID = frameData.ID - 1;

                if (frames.ContainsKey(previousFrameID))
                {
                    var previousFrameData = frames[previousFrameID];
                    frameData.Duration = GetTimeSpanDelta(frameData.TimeStamp, previousFrameData.TimeStamp);
                }
            }
コード例 #2
0
            private static LogLineFrameData GetFrameData(LogLine logLine)
            {
                Debug.Assert(logLine != null);

                Match framesCompleted = FahLogRegex.Common.FramesCompletedRegex.Match(logLine.Raw);

                if (framesCompleted.Success)
                {
                    var frame = new LogLineFrameData();

                    if (Int32.TryParse(framesCompleted.Groups["Completed"].Value, out var result))
                    {
                        frame.RawFramesComplete = result;
                    }
                    else
                    {
                        return(null);
                    }

                    if (Int32.TryParse(framesCompleted.Groups["Total"].Value, out result))
                    {
                        frame.RawFramesTotal = result;
                    }
                    else
                    {
                        return(null);
                    }

                    if (!Int32.TryParse(framesCompleted.Groups["Percent"].Value, out var framePercent))
                    {
                        return(null);
                    }

                    // Validate the steps are in tolerance with the detected frame percent - Issue 98
                    double calculatedPercent = ((double)frame.RawFramesComplete / frame.RawFramesTotal) * 100;
                    // ex. [00:19:40] Completed 82499 out of 250000 steps  (33%) - Would Validate
                    //     [00:19:40] Completed 82750 out of 250000 steps  (33%) - Would Validate
                    // 10% frame step tolerance. In the example the completed must be within 250 steps.
                    if (Math.Abs(calculatedPercent - framePercent) <= 0.1)
                    {
                        if (logLine.TimeStamp != null)
                        {
                            frame.TimeStamp = logLine.TimeStamp.Value;
                        }
                        frame.ID = framePercent;

                        return(frame);
                    }

                    return(null);
                }

                return(null);
            }
コード例 #3
0
            internal static LogLineFrameData ParseLogLineFrame(LogLine logLine)
            {
                LogLineFrameData frameData = GetFrameData(logLine);

                if (frameData != null)
                {
                    return(frameData);
                }

                frameData = GetGpuFrameData(logLine);
                return(frameData);
            }
コード例 #4
0
            private static LogLineFrameData GetGpuFrameData(LogLine logLine)
            {
                Debug.Assert(logLine != null);

                Match framesCompletedGpu = FahLogRegex.Common.FramesCompletedGpuRegex.Match(logLine.Raw);

                if (framesCompletedGpu.Success)
                {
                    var frame = new LogLineFrameData();

                    frame.RawFramesComplete = Int32.Parse(framesCompletedGpu.Groups["Percent"].Value, CultureInfo.InvariantCulture);
                    frame.RawFramesTotal    = 100;

                    if (logLine.TimeStamp != null)
                    {
                        frame.TimeStamp = logLine.TimeStamp.Value;
                    }
                    frame.ID = frame.RawFramesComplete;

                    return(frame);
                }

                return(null);
            }