protected void InitThisTest(string testConfiguration) { InitTestScenario(testConfiguration); IZppSimulator zppSimulator = new global::Master40.SimulationMrp.impl.ZppSimulator(); // TODO: set to true once dbPersist() has an acceptable time and and enable ReloadTransactionData zppSimulator.StartPerformanceStudy(false); // IDbTransactionData dbTransactionData = // ZppConfiguration.CacheManager.ReloadTransactionData(); }
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); ICentralPlanningConfiguration testConfiguration = ZppConfiguration.CacheManager.GetTestConfiguration(); int customerOrderCount = ZppConfiguration.CacheManager.GetTestConfiguration() .CustomerOrderPartQuantity; int customerOrderCountOriginal = customerOrderCount; int elapsedMinutes = 0; 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 global::Master40.SimulationMrp.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); }