コード例 #1
0
        public List <VerifyResult> SyncVerify(List <ArchDesignConfig> designSet)
        {
            PATUtil util = new PATUtil();

            // generate CSP Code
            resultSet = new List <VerifyResult>();
            List <ThreadedVerificationExecuter <VerifyResult> > threadsList = new List <ThreadedVerificationExecuter <VerifyResult> >();
            ThreadedVerificationExecuter <VerifyResult>         thread;

            PAT.CSP.ModuleFacade modulebase = new PAT.CSP.ModuleFacade();
            foreach (ArchDesignConfig designConfig in designSet)
            {
                VerifyAsset       verifyAsset = util.GenerateAsset(designConfig.matrix);
                SpecificationBase specbase    = modulebase.ParseSpecification(verifyAsset.CSPCode, string.Empty, string.Empty);
                thread = new ThreadedVerificationExecuter <VerifyResult>(collectVerifyResult, verifyAsset, specbase);
                threadsList.Add(thread);
                thread.Start();
            }

            while (resultSet.Count < designSet.Count)
            {
                System.Diagnostics.Debug.WriteLine("Waiting for result " + resultSet.Count);
            }
            return(resultSet);
        }
コード例 #2
0
ファイル: PATTestController.cs プロジェクト: cnacha/PATWebAPI
        public VerifyResult AsyncVerify(List <ArchMatrix> matrix)
        {
            PATUtil util = new PATUtil();
            // generate CSP Code
            VerifyAsset verifyAsset = util.GenerateAsset(matrix);
            int         totalAsert  = verifyAsset.deadloopCheck.Count + verifyAsset.livelockCheck.Count;

            System.Diagnostics.Debug.WriteLine("total Assertion" + totalAsert);

            //initialize CSP module with CSP Code
            PAT.CSP.ModuleFacade modulebase = new PAT.CSP.ModuleFacade();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            SpecificationBase specbase = modulebase.ParseSpecification(verifyAsset.CSPCode, string.Empty, string.Empty);

            // run assertions and gather results
            results = new ConcurrentBag <DiagnosisResult>();
            foreach (String assertionName in verifyAsset.deadloopCheck)
            {
                results.Add(util.executeAssertion(specbase, assertionName));
            }
            foreach (String assertionName in verifyAsset.livelockCheck)
            {
                results.Add(util.executeAssertion(specbase, assertionName));
            }
            sw.Stop();
            VerifyResult verResult = new VerifyResult();

            verResult.elapseTime    = sw.ElapsedMilliseconds;
            verResult.diagnosisList = results;
            System.Diagnostics.Debug.WriteLine("Total Result" + results.Count);

            return(verResult);
        }
コード例 #3
0
ファイル: PATTestController.cs プロジェクト: cnacha/PATWebAPI
        public VerifyResult SyncVerify(List <ArchMatrix> matrix)
        {
            // change this for performance tuning
            int maxConcurrent = 8;

            PATUtil util = new PATUtil();
            // generate CSP Code
            VerifyAsset verifyAsset = util.GenerateAsset(matrix);
            int         totalAsert  = verifyAsset.deadloopCheck.Count + verifyAsset.livelockCheck.Count;

            System.Diagnostics.Debug.WriteLine("total Assertion" + totalAsert);

            //initialize CSP module with CSP Code
            PAT.CSP.ModuleFacade modulebase = new PAT.CSP.ModuleFacade();
            Stopwatch            sw         = new Stopwatch();

            sw.Start();
            SpecificationBase specbase = modulebase.ParseSpecification(verifyAsset.CSPCode, string.Empty, string.Empty);

            // run assertions and gather results
            results = new ConcurrentBag <DiagnosisResult>();
            ThreadedAssertionExecuter <DiagnosisResult>         executer;
            List <ThreadedAssertionExecuter <DiagnosisResult> > threadsList = new List <ThreadedAssertionExecuter <DiagnosisResult> >();

            foreach (String assertionName in verifyAsset.deadloopCheck)
            {
                //    System.Diagnostics.Debug.WriteLine("executing " + assertionName);
                executer = new ThreadedAssertionExecuter <DiagnosisResult>(callBack, specbase, assertionName);
                threadsList.Add(executer);
            }
            foreach (String assertionName in verifyAsset.livelockCheck)
            {
                threadsList.Add(new ThreadedAssertionExecuter <DiagnosisResult>(callBack, specbase, assertionName));
            }

            for (int i = 0; i < totalAsert; i += maxConcurrent)
            {
                int beforeNumResult = results.Count;
                int num             = maxConcurrent;
                if (i + maxConcurrent > totalAsert)
                {
                    num = totalAsert % maxConcurrent;
                }
                for (int j = 0; j < num; j++)
                {
                    //    System.Diagnostics.Debug.WriteLine("Starting ->" + i +" "+j);
                    threadsList[i + j].Start();
                }

                // gather results
                while (results.Count < beforeNumResult + num)
                {
                    //  System.Diagnostics.Debug.WriteLine("Waiting to finish..." + results.Count);
                }
            }
            sw.Stop();
            VerifyResult verResult = new VerifyResult();

            verResult.elapseTime    = sw.ElapsedMilliseconds;
            verResult.diagnosisList = results;
            System.Diagnostics.Debug.WriteLine("Total Results" + results.Count);

            return(verResult);
        }