Exemple #1
0
        /// <summary>
        /// Check the given log line for Completed Frame information (All other clients).
        /// </summary>
        /// <param name="logLine">Log Line</param>
        protected static UnitFrame GetUnitFrame(LogLine logLine)
        {
            Debug.Assert(logLine != null);

             Match mFramesCompleted = FramesCompletedRegex.Match(logLine.LineRaw);
             if (mFramesCompleted.Success)
             {
            var frame = new UnitFrame();

            int result;
            if (Int32.TryParse(mFramesCompleted.Result("${Completed}"), out result))
            {
               frame.RawFramesComplete = result;
            }
            else
            {
               return null;
            }

            if (Int32.TryParse(mFramesCompleted.Result("${Total}"), out result))
            {
               frame.RawFramesTotal = result;
            }
            else
            {
               return null;
            }

            string percentString = mFramesCompleted.Result("${Percent}");

            Match mPercent1 = Percent1Regex.Match(percentString);
            Match mPercent2 = Percent2Regex.Match(percentString);

            int framePercent;
            if (mPercent1.Success)
            {
               framePercent = Int32.Parse(mPercent1.Result("${Percent}"));
            }
            else if (mPercent2.Success)
            {
               framePercent = Int32.Parse(mPercent2.Result("${Percent}"));
            }
            // Try to parse a percentage from in between the parentheses (for older single core clients like v5.02) - Issue 36
            else if (!Int32.TryParse(percentString, out 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)
            {
               frame.TimeOfFrame = logLine.ParseTimeStamp();
               frame.FrameID = framePercent;

               return frame;
            }
            /*** ProtoMol Only */
            // Issue 191 - New ProtoMol Projects don't report frame progress on the precent boundry.
            if (Math.Abs(calculatedPercent - (framePercent + 1)) <= 0.1)
            {
               frame.TimeOfFrame = logLine.ParseTimeStamp();
               frame.FrameID = framePercent + 1;

               return frame;
            }
            /*******************/

            return null;
             }

             return null;
        }
Exemple #2
0
        /// <summary>
        /// Check the given log line for Completed Frame information (GPU Only).
        /// </summary>
        /// <param name="logLine">Log Line</param>
        protected static UnitFrame GetGpuUnitFrame(LogLine logLine)
        {
            Debug.Assert(logLine != null);

             Match mFramesCompletedGpu = FramesCompletedGpuRegex.Match(logLine.LineRaw);
             if (mFramesCompletedGpu.Success)
             {
            var frame = new UnitFrame();

            frame.RawFramesComplete = Int32.Parse(mFramesCompletedGpu.Result("${Percent}"));
            frame.RawFramesTotal = 100; //Instance.CurrentProtein.Frames
            // I get this from the project data but what's the point. 100% is 100%.

            frame.TimeOfFrame = logLine.ParseTimeStamp();
            frame.FrameID = frame.RawFramesComplete;

            return frame;
             }

             return null;
        }