private static void DbRunnerTest(string db, List <MasterCustomer> customers, List <MasterItem> items, List <string> tags) { Console.WriteLine("Running database Test type: " + db); using (DbCommonMethods obj = (DbCommonMethods)Activator.CreateInstance(Type.GetType(db, true))) { //Initialize DB schemes MeasurementTool tool = new MeasurementTool(1, 1, 100000, db); obj.Initiate(); obj.Seed(1000, items, customers, tags); obj.Create(ref tool, items, null); Console.Read(); } }
private static void DbRunner(string db, List <MasterCustomer> customers, List <MasterItem> items, List <string> tags) { Console.WriteLine("Running database type: " + db); for (int round = 0; round <= 10; round++) { for (int threadcount = 1; threadcount <= 8; threadcount *= 2) { for (int dbSizeFactor = 100; dbSizeFactor <= 100000; dbSizeFactor *= 10) { //Write progress report Console.WriteLine( "\tRunning params: Round=" + round + "/10 Thread= " + threadcount + "/8 Througput=" + dbSizeFactor + "/100000"); Thread[] ts = new Thread[threadcount]; for (int i = 0; i < ts.Length; i++) { ts[i] = new Thread(() => { DbCommonMethods obj = (DbCommonMethods)Activator.CreateInstance(Type.GetType(db, true)); MeasurementTool tool = new MeasurementTool(round, threadcount, dbSizeFactor, db); obj.Create(ref tool); obj.Read(ref tool); obj.Updater(ref tool); queue.Enqueue(tool); }); } using (DbCommonMethods obj = (DbCommonMethods)Activator.CreateInstance(Type.GetType(db, true))) { //Initialize DB schemes obj.Initiate(); obj.Seed(dbSizeFactor, items, customers, tags); foreach (var t in ts) { t.Start(); } //Run workload foreach (var t in ts) { t.Join(); } } // TEARDOWN of DB Schemes / data } } } }