static void Main(string[] args) { RpcAPI performance; if (args.Length == 1) { performance = new RpcAPI(8, 2000, args[0]); } else if (args.Length == 3) { int threadNo = Int32.Parse(args[0]); int execTimes = Int32.Parse(args[1]); performance = new RpcAPI(threadNo, execTimes, args[2]); } else if (args.Length == 4) { int threadNo = Int32.Parse(args[0]); int execTimes = Int32.Parse(args[1]); performance = new RpcAPI(threadNo, execTimes, args[2], args[3]); } else { performance = new RpcAPI(8, 2000); } //Execute command performance.PrepareEnv(); performance.InitExecRpcCommand(); performance.DeployContract(); performance.InitializeContract(); performance.LoadAllContractAbi(); ExecuteRpcTask(performance); //Result summary CategoryInfoSet set = new CategoryInfoSet(performance.CH.CommandList); set.GetCategoryBasicInfo(); set.GetCategorySummaryInfo(); set.SaveTestResultXml(performance.ThreadCount); Console.WriteLine("Complete performance testing."); Console.ReadLine(); }
static void Main(string[] args) { //Init Logger string logName = "RpcPerformance" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".log"; string dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs", logName); Logger.InitLogHelper(dir); RpcAPI performance; if (args.Length == 1) { performance = new RpcAPI(4, 50, args[0]); } else if (args.Length == 3) { int threadNo = Int32.Parse(args[0]); int execTimes = Int32.Parse(args[1]); performance = new RpcAPI(threadNo, execTimes, args[2]); } else if (args.Length == 4) { int threadNo = Int32.Parse(args[0]); int execTimes = Int32.Parse(args[1]); performance = new RpcAPI(threadNo, execTimes, args[2], args[3]); } else { performance = new RpcAPI(8, 2000); } //Execute command try { performance.PrepareEnv(); performance.InitExecRpcCommand(); performance.DeployContract(); performance.InitializeContract(); performance.LoadAllContractAbi(); bool autoTest = args?.Length == 1; ExecuteRpcTask(performance, autoTest); } catch (Exception e) { Logger.WriteError(e.Message); } finally { //Delete accounts performance.DeleteAccounts(); } //Result summary CategoryInfoSet set = new CategoryInfoSet(performance.CH.CommandList); set.GetCategoryBasicInfo(); set.GetCategorySummaryInfo(); set.SaveTestResultXml(performance.ThreadCount); Logger.WriteInfo("Complete performance testing."); Console.ReadLine(); }