Exemple #1
0
        private void ExecutePerformanceStudy(string testConfigurationFileName, bool shouldPersist)
        {
            PerformanceMonitor performanceMonitor = new PerformanceMonitor(InstanceToTrack.Global);
            // int maxPossibleCops = int.MaxValue / 100;
            int maxPossibleCops = 1000;

            ZppConfiguration.CacheManager.ReadInTestConfiguration(testConfigurationFileName);
            TestConfiguration testConfiguration =
                ZppConfiguration.CacheManager.GetTestConfiguration();
            int customerOrderCount = ZppConfiguration.CacheManager.GetTestConfiguration()
                                     .CustomerOrderPartQuantity;
            int customerOrderCountOriginal = customerOrderCount;
            int elapsedMinutes             = 0;
            int elapsedSeconds             = 0;
            int maxTime = 5;
            int cycles  = testConfiguration.SimulationMaximumDuration /
                          testConfiguration.SimulationInterval;

            string performanceLogLastCycles = "[";

            // n cycles here each cycle create & plan configured CustomerOrderPart
            while (customerOrderCount <= maxPossibleCops && elapsedMinutes < 5)
            {
                InitThisTest(testConfigurationFileName);

                IZppSimulator zppSimulator = new ZppSimulator.impl.ZppSimulator();
                performanceMonitor.Start();

                zppSimulator.StartPerformanceStudy(shouldPersist);
                performanceMonitor.Stop();
                if (performanceLogLastCycles.Length > 1)
                {
                    performanceLogLastCycles += ",";
                }
                performanceLogLastCycles += "{" + performanceMonitor.ToString();
                long currentMemoryUsage = Process.GetCurrentProcess().WorkingSet64;
                performanceLogLastCycles +=
                    $"\"CurrentMemoryUsage\": \"{currentMemoryUsage}\"" +
                    Environment.NewLine;
                performanceLogLastCycles += "}" + Environment.NewLine;

                customerOrderCount += customerOrderCountOriginal;
                testConfiguration.CustomerOrderPartQuantity = customerOrderCount;
            }
            // just for correct log name
            customerOrderCount -= customerOrderCountOriginal;
            testConfiguration.CustomerOrderPartQuantity = customerOrderCount;

            performanceLogLastCycles += "]";
            string logType = $"_{testConfiguration.Name}_cycles_{cycles}_COs_{testConfiguration.CustomerOrderPartQuantity}_lastCycles";

            ;
            DebuggingTools.WritePerformanceLog(performanceLogLastCycles, logType);
        }
Exemple #2
0
        public void StartPerformanceStudy(bool shouldPersist)
        {
            ZppConfiguration.IsInPerformanceMode = true;

            int maxSimulatingTime = ZppConfiguration.CacheManager.GetTestConfiguration()
                                    .SimulationMaximumDuration;
            int defaultInterval =
                ZppConfiguration.CacheManager.GetTestConfiguration().SimulationInterval;
            Quantity customerOrderQuantity = new Quantity(ZppConfiguration.CacheManager
                                                          .GetTestConfiguration().CustomerOrderPartQuantity);

            _customerOrderCreator = new CustomerOrderCreator(customerOrderQuantity);

            string performanceLogCycles = "[";

            _performanceMonitors.Start(InstanceToTrack.Global);

            for (int i = 0; i *defaultInterval <= maxSimulatingTime; i++)
            {
                SimulationInterval simulationInterval =
                    new SimulationInterval(i * defaultInterval, defaultInterval - 1);

                StartOneCycle(simulationInterval, customerOrderQuantity);

                if (ZppConfiguration.CacheManager.GetDbTransactionDataArchive()
                    .CustomerOrderPartGetAll().Count() > customerOrderQuantity.GetValue())
                {
                    break;
                }

                performanceLogCycles += _performanceMonitors.ToString() + ",";
            }

            _performanceMonitors.Stop(InstanceToTrack.Global);
            performanceLogCycles += $"{_performanceMonitors.ToString()}]";

            // DebuggingTools.PrintStateToFiles(dbTransactionData, true);
            DebuggingTools.WritePerformanceLog(performanceLogCycles);

            // persisting cached/created data
            if (shouldPersist)
            {
                ZppConfiguration.CacheManager.Persist();
            }
        }
        public void StartPerformanceStudy(bool shouldPersist)
        {
            ZppConfiguration.IsInPerformanceMode = true;

            int maxSimulatingTime = ZppConfiguration.CacheManager.GetTestConfiguration()
                                    .SimulationMaximumDuration;
            int defaultInterval =
                ZppConfiguration.CacheManager.GetTestConfiguration().SimulationInterval;
            Quantity customerOrderQuantity = new Quantity(ZppConfiguration.CacheManager
                                                          .GetTestConfiguration().CustomerOrderPartQuantity);

            _customerOrderCreator = new CustomerOrderCreator(customerOrderQuantity);

            string performanceLogCycles = "[";

            for (int i = 0; i *defaultInterval <= maxSimulatingTime; i++)
            {
                SimulationInterval simulationInterval =
                    new SimulationInterval(i * defaultInterval, defaultInterval - 1);

                StartOneCycle(simulationInterval, customerOrderQuantity);

                if (ZppConfiguration.CacheManager.GetDbTransactionDataArchive()
                    .CustomerOrderPartGetAll().Count() > customerOrderQuantity.GetValue())
                {
                    break;
                }
            }
            // TODO: here is no performance measure anymore, remove whole surounding method ?
            // DebuggingTools.PrintStateToFiles(dbTransactionData, true);
            DebuggingTools.WritePerformanceLog(performanceLogCycles);

            // persisting cached/created data
            if (shouldPersist)
            {
                ZppConfiguration.CacheManager.Persist();
            }
        }