Пример #1
0
        //engineIndex 0 for Depth First Search, 1 for Breadth First Search
        public DiagnosisResult Run()
        {
            // System.Diagnostics.Debug.WriteLine("running "+assertion);
            // return CreatedAtRoute("GetProduct", new { id = item.Id }, item);
            assertion.UIInitialize(null, fairnessIndex, engineIndex);

            assertion.VerificationMode = true;
            assertion.InternalStart();

            assertion.GetVerificationStatistics();
            DiagnosisResult result = new DiagnosisResult();

            result.Assertion = assertion.ToString();

            //   System.Diagnostics.Debug.WriteLine("VALID? " + assertion.VerificationOutput.VerificationResult.Equals(VerificationResultType.VALID));
            string scenarioDesc = "";

            //    System.Diagnostics.Debug.WriteLine("loop: " + assertion.VerificationOutput.LoopIndex);

            result.MemoryUsage    = assertion.VerificationOutput.EstimateMemoryUsage;
            result.TotalTime      = assertion.VerificationOutput.VerificationTime;
            result.NumberOfStates = assertion.VerificationOutput.NoOfStates;
            result.LoopIndex      = assertion.VerificationOutput.LoopIndex;
            //   System.Diagnostics.Debug.WriteLine("==totaltime: " + assertion.VerificationOutput.VerificationTime);

            if (assertion.VerificationOutput.VerificationResult.Equals(VerificationResultType.VALID))
            {
                result.IsValid = true;
            }
            else
            {
                result.IsValid = false;
            }
            if (assertion.VerificationOutput.CounterExampleTrace != null)
            {
                foreach (ConfigurationBase step in assertion.VerificationOutput.CounterExampleTrace)
                {
                    scenarioDesc += " " + step.GetDisplayEvent();
                }
                result.Scenario = scenarioDesc;
                //       System.Diagnostics.Debug.WriteLine(scenarioDesc);
            }

            // determine symthomp
            if (result.LoopIndex >= 0)
            {
                result.Symptom = "deadloop";
            }
            else if (result.Scenario != null && hasDuplilcateInvoke(result.Scenario))
            {
                result.Symptom = "livelock";
            }
            else
            {
                result.Symptom = "normal";
            }

            return(result);
        }
Пример #2
0
        //engineIndex 0 for Depth First Search, 1 for Breadth First Search
        private DiagnosisResult RunAssertion(AssertionBase assertion, int fairnessIndex, int engineIndex)
        {
            System.Diagnostics.Debug.WriteLine(assertion);
            // return CreatedAtRoute("GetProduct", new { id = item.Id }, item);
            assertion.UIInitialize(null, fairnessIndex, engineIndex);

            assertion.VerificationMode = true;
            assertion.InternalStart();

            System.Diagnostics.Debug.WriteLine(assertion.GetVerificationStatistics());
            DiagnosisResult result = new DiagnosisResult();

            result.Assertion = assertion.ToString();

            System.Diagnostics.Debug.WriteLine("VALID? " + assertion.VerificationOutput.VerificationResult.Equals(VerificationResultType.VALID));
            string scenarioDesc = "";

            System.Diagnostics.Debug.WriteLine("loop: " + assertion.VerificationOutput.LoopIndex);

            result.MemoryUsage    = assertion.VerificationOutput.EstimateMemoryUsage;
            result.TotalTime      = assertion.VerificationOutput.VerificationTime;
            result.NumberOfStates = assertion.VerificationOutput.NoOfStates;
            result.LoopIndex      = assertion.VerificationOutput.LoopIndex;

            if (assertion.VerificationOutput.VerificationResult.Equals(VerificationResultType.VALID))
            {
                result.IsValid = true;
            }
            else
            {
                result.IsValid = false;
            }
            if (assertion.VerificationOutput.CounterExampleTrace != null)
            {
                foreach (ConfigurationBase step in assertion.VerificationOutput.CounterExampleTrace)
                {
                    scenarioDesc += " " + step.GetDisplayEvent();
                }
                result.Scenario = scenarioDesc;
                System.Diagnostics.Debug.WriteLine(scenarioDesc);
            }

            return(result);
        }
Пример #3
0
        internal void Update(AssertionBase assertion)
        {
            // 2015-11-21-thu-update latex
            AssertType assertType = AssertType.NONE;
            string     non = "deadlockfree", channel = "_";
            string     assertion_text = assertion.ToString();

            if (assertion_text.Contains(non))
            {
                assertType = AssertType.DEADLOCK_FREE;
            }
            else if (assertion_text.Contains(channel))
            {
                assertType = AssertType.CONGESTION_CHANNEL;
            }
            else
            {
                assertType = AssertType.CONGESTION_SENSOR;
            }

            string result      = assertion.getResult();
            string resultlatex = "";

            // Get result of assersion
            do
            {
                if (assertType.Equals(AssertType.DEADLOCK_FREE))
                {
                    if (result.Equals("VALID"))
                    {
                        resultlatex = "\\vl";
                    }
                    else if (result.Equals("INVALID"))
                    {
                        resultlatex = "\\nv";
                    }
                    else
                    {
                        resultlatex = "\\unk";
                    }
                    break;
                }

                if (result.Equals("VALID"))
                {
                    resultlatex = "\\nv";
                }
                else if (result.Equals("INVALID"))
                {
                    resultlatex = "\\vl";
                }
                else
                {
                    resultlatex = "\\unk";
                }
            } while (false);

            // Mapping record to variable
            do
            {
                int posType = -1;
                if (assertType.Equals(AssertType.DEADLOCK_FREE))
                {
                    posType = 0;
                }
                else if (assertType.Equals(AssertType.CONGESTION_CHANNEL))
                {
                    posType = 1;
                }
                else if (assertType.Equals(AssertType.CONGESTION_SENSOR))
                {
                    posType = 2;
                }

                if (posType < 0)
                {
                    break;
                }

                mParseRes[posType].mTime       = assertion.getTimes();
                mParseRes[posType].mMemo       = (float)assertion.getMems();
                mParseRes[posType].mTransition = assertion.getTransitions();
                mParseRes[posType].mState      = assertion.getStates();
                mParseRes[posType].mClicked    = true;
                mParseRes[posType].mRes        = resultlatex;
            } while (false);
        }