//public void Check(string msg) //{ // //System.Configuration.AppSettingsReader r = new System.Configuration.AppSettingsReader(); // //string path = (string)r.GetValue("GeneralLog", typeof(String)); // //using (StreamWriter outfile = File.AppendText(path)) // //{ // // outfile.WriteLine("Check was called with : " + msg); // // outfile.Close(); // //} //} public void PerformanceSimulation() { SimulationDL.Readfromfile();//this is enough for simulation, this.sim = SimulationDL.sim; StackTrace stackTrace = new StackTrace(); MethodBase methodBase = stackTrace.GetFrame(1).GetMethod(); methodName = methodBase.Name; var query = from p in sim.methodSimulationMap where p.methodname == methodName select p; sa = query.ToList()[0]; if (sa.throwException) { throw new Exception(); } System.Threading.Thread.Sleep(sa.sleep * 1000); //convert seconds to milliseconds if (sa.consumeheap) { keepConsuming = true; Runconsumeheap(sa.consumeheapfactor); } if (sa.consumecpu) { workerThread.Start(); } }
void watcher_Changed(object sender, FileSystemEventArgs e) { SimulationDL.Readfromfile();//this is enough for simulation, this.sim = SimulationDL.sim; if (methodName != null) { var query = from p in sim.methodSimulationMap where p.methodname == methodName select p; sa = query.ToList()[0]; keepConsuming = sa.consumeheap; } }