public void Run(DateTime dtInit)
        {
            if (SimulationData.AvailableSnapshots.Count > 0)
            {
                int rangeSize = _statsRangeLength;

                int totalRanges = (int)Math.Round((float)SimulationData.AvailableSnapshots.Count / (float)rangeSize);

                SimDateTime firstSnapshotStart = SimulationData.AvailableSnapshots[0];

                for (int id = 0; id < totalRanges; id++)
                {
                    _doneEvents.Add(new ManualResetEvent(false));

                    ThreadPool.QueueUserWorkItem((c) => ProcessSimRange(dtInit, firstSnapshotStart, rangeSize, (int)c), id);
                    //ProcessSimRange(dtInit, firstSnapshotStart, rangeSize, id);
                }

                ManualResetEvent.WaitAll(_doneEvents.ToArray());

                TimeSpan tsDiff = DateTime.Now - dtInit;
                Console.WriteLine($"  -> Statistics completed after {(int)tsDiff.TotalMilliseconds} msec.");
            }

            FileSupport.WaitForPendingWriteOperations();
        }
示例#2
0
        public void Run(DateTime dtInit)
        {
            Console.WriteLine("  -> Starting simulation ...");

            if (_sim != null)
            {
                _sim.Run(dtInit);
            }

            GC.Collect();

            FileSupport.WaitForPendingWriteOperations();

            TimeSpan tsDiff = DateTime.Now - dtInit;

            Console.WriteLine($"  -> Simulation completed after {(int)tsDiff.TotalMilliseconds} msec.");
        }