Exemple #1
0
        public void FindConflictGraphs(ConflictGraph conflictGraph)
        {
            int skip = 0;

            ConflictGraph cpconflictGraph;

            cpconflictGraph = conflictGraph.DeepCopy();

            cpconflictGraph.nbRepairedDR = 0;
            cpconflictGraph.nbMovedAwait = 0;

            while (cpconflictGraph.MoveAwait(skip))
            {
                cpconflictGraph.RepairGraph();
                skip = skip + 1;
                //nbAllAsychronizations = nbAllAsychronizations + 1;
                //nbRepairedDataRaces = nbRepairedDataRaces + cpconflictGraph.nbRepairedDR;
                //allConflictGraphs.Add(cpconflictGraph);
                if (AddConflictGraph(cpconflictGraph))
                {
                    FindConflictGraphs(cpconflictGraph);
                }
                cpconflictGraph = conflictGraph.DeepCopy();
            }

            if (skip > nbMovableAwaits)
            {
                nbMovableAwaits = skip;
            }
        }
Exemple #2
0
        public ConflictGraphs(string[] args)
        {
            allConflictGraphs = new List <ConflictGraph>();

            nbAsychronizations = 0;
            //nbAllAsychronizations = 0;
            nbRepairedDataRaces      = 0;
            nbMovableAwaits          = 0;
            nbMethods                = 0;
            nbInvocations            = 0;
            nbAsyncInvocations       = 0;
            nbPotentialMovableAwaits = 0;
            distanceAwaits           = 0;

            Setups();

            if (args.Length > 0)
            {
                ConflictGraph conflictGraph = new ConflictGraph();

                int iden = 0;

                if (args.Length > 1)
                {
                    try
                    {
                        iden = Int32.Parse(args[1]);
                        //Console.WriteLine($"The project Id is: '{iden}'");
                    }
                    catch (FormatException)
                    {
                        // Console.WriteLine($"Unable to parse '{args[1]}'");
                    }
                }

                conflictGraph.SetUp(args[0], iden, sysMethods, sysMethodsConflicts);

                nbMethods = conflictGraph.progMethods.Count;

                nbInvocations = conflictGraph.TotalNbInvocations();

                if (conflictGraph.isAsync)
                {
                    conflictGraph.DesynchronizeAsynchrony();
                    nbPotentialMovableAwaits = conflictGraph.NbPotentialMovableAwaits();
                    conflictGraph.RepairGraph();
                    distanceAwaits = conflictGraph.DistanceMovableAwaits();
                }
                else
                {
                    conflictGraph.Desynchronize();
                    nbPotentialMovableAwaits = conflictGraph.NbPotentialMovableAwaits();
                    conflictGraph.RepairGraph();
                    distanceAwaits = conflictGraph.DistanceMovableAwaits();
                }

                nbAsyncInvocations = conflictGraph.TotalAsyncNbInvocations();

                Debug.Assert(nbInvocations >= nbAsyncInvocations);

                //nbAllAsychronizations = nbAllAsychronizations + 1;

                gconflictGraph = conflictGraph.DeepCopy();

                nbRepairedDataRaces = nbRepairedDataRaces + gconflictGraph.nbRepairedDR;

                allConflictGraphs.Add(gconflictGraph);

                FindConflictGraphs(conflictGraph);

                nbAsychronizations = allConflictGraphs.Count;

                Debug.Assert(nbPotentialMovableAwaits >= nbMovableAwaits);
            }
        }