/// <summary> /// 获取主库数据 /// </summary> static void GetRedisData() { System.Console.WriteLine("****指令数统计中****"); long totalNum = 0; long totalOne = 0; long totalTwo = 0; long totalThree = 0; long totalDelelte = 0; List <TerResultEntiy> listReturn = new List <TerResultEntiy>(); for (int i = 1; i < 50001; i++) { listReturn = SendDataCache.GetSendData((IMEI_PREX + i).ToString()); if (listReturn != null) { totalNum += listReturn.Count; } //totalOne += listReturn.Where(p => p.ReadCount == 3 && p.ErrorCode>0).ToList().Count; //totalTwo += listReturn.Where(p => p.ReadCount == 2 && p.ErrorCode > 0).ToList().Count; //totalThree += listReturn.Where(p => p.ReadCount == 1 && p.ErrorCode > 0).ToList().Count; //totalDelelte+= listReturn.Where(p => p.ReadCount == 0).ToList().Count; } System.Console.WriteLine($"重发1次:{totalOne}\r\n"); System.Console.WriteLine($"重发2次:{totalTwo}\r\n"); System.Console.WriteLine($"重发3次:{totalThree}\r\n"); System.Console.WriteLine($"重发成功数:{totalDelelte}\r\n"); System.Console.WriteLine($"总数:{totalNum}\r\n"); }
/// <summary> /// 测试主业务Get耗时(6/ms) /// </summary> static void TestBusinessMainGet() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); System.Diagnostics.Stopwatch swTotal = new System.Diagnostics.Stopwatch(); System.Console.WriteLine("****Set执行中......****"); swTotal.Start(); for (int i = 0; i < IMEI_NUM; i++) { //sw.Restart(); SendDataCache.GetSendData((IMEI_PREX + i).ToString()); //sw.Stop(); //System.Console.WriteLine($"IMEI:{(IMEI_PREX + i).ToString()} takes {sw.Elapsed} ms"); } swTotal.Stop(); System.Console.WriteLine($"All IMEIS takes {swTotal.ElapsedMilliseconds} ms"); }
/// <summary> /// 测试主业务Removet耗时(6/ms) /// </summary> static void TestBusinessMainRemove() { string sourceData_Login = "******"; //登陆包 string sourceData_Heartbeat = "*VK2015{0},AH#"; //心跳包 System.Console.WriteLine("****Set执行中......****"); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); System.Diagnostics.Stopwatch swTotal = new System.Diagnostics.Stopwatch(); swTotal.Start(); try { for (int i = 0; i < IMEI_NUM; i++) { TerResultEntiy entity = new TerResultEntiy((IMEI_PREX + i).ToString(), Encoding.ASCII.GetBytes(sourceData_Login), ORDERLOGIN_PREX_REMOVE + i, 1, 0, 1, DateTime.Now.Ticks) { }; //sw.Restart(); SendDataCache.RemoveSendData(entity); //sw.Stop(); //System.Console.WriteLine($"IMEI:{(IMEI_PREX + i).ToString()} takes {sw.Elapsed} ms"); } swTotal.Stop(); System.Console.WriteLine($"All IMEIS takes {swTotal.ElapsedMilliseconds} ms"); ORDERLOGIN_PREX_REMOVE = ORDERLOGIN_PREX_REMOVE + 1000000; } catch (Exception ex) { System.Console.WriteLine(ex.Message); } }