Microsoft.Zing.FrontierSet.StartOfIterationReset C# (CSharp) Méthode

StartOfIterationReset() public méthode

Reset workers before start of next iteration
public StartOfIterationReset ( ) : void
Résultat void
        public void StartOfIterationReset()
        {
            if (!ZingerConfiguration.FrontierToDisk)
            {
                InMemoryCurrentGlobalFrontier = new ConcurrentQueue<FrontierNode>();

                //Move all the next iteration frontiers to current set.
                if (InMemoryNextGlobalFrontier.Count > 0)
                {
                    if (ZingerConfiguration.DegreeOfParallelism == 1)
                    {
                        var temp = InMemoryNextGlobalFrontier.OrderBy(x => x.Key).AsParallel().WithDegreeOfParallelism(ZingerConfiguration.DegreeOfParallelism).Select(fNode => { InMemoryCurrentGlobalFrontier.Enqueue(fNode.Value); return false; }).Min();
                    }
                    else
                    {
                        var temp = InMemoryNextGlobalFrontier.AsParallel().WithDegreeOfParallelism(ZingerConfiguration.DegreeOfParallelism).Select(fNode => { InMemoryCurrentGlobalFrontier.Enqueue(fNode.Value); return false; }).Min();
                    }
                }

                InMemoryNextGlobalFrontier.Clear();
                System.GC.Collect();
            }

            //check if the memory consumed currently is 70% of the max memory
            var CurrentMem = System.Diagnostics.Process.GetCurrentProcess().NonpagedSystemMemorySize64 / Math.Pow(10, 9);
            if (CurrentMem > 0.75 * ZingerConfiguration.MaxMemoryConsumption && !ZingerConfiguration.FrontierToDisk)
            {
                ZingerConfiguration.FrontierToDisk = true;
                //TODO: Push all the frontiers in memory onto disk.
            }

            // Initialize frontier to Disk
            if (ZingerConfiguration.FrontierToDisk)
            {
                nextFrontierSetHT.Clear();
                counter = 0;
                //reset the blocking collection
                currFrontierSet = new BlockingCollection<FrontierNode>(bufferSize);
                nextFrontierSet = new BlockingCollection<KeyValuePair<Fingerprint, FrontierNode>>(2 * bufferSize);
            }

            InitializeFrontierForce();
        }