1 using Net.Sz.Framework.Netty.Http; 2 using Net.Sz.Framework.Util; 3 using System; 4 using System.Collections.Generic; 5 using System.Linq; 6 using System.Text; 7 using System.Threading; 8 using System.Threading.Tasks; namespace CApp_CheckLoginTps 12 { Program 15 { List<int> idList = new List<int>(); 18 static IntegerSSId ids = new IntegerSSId(); Main(string[] args) 21 { 22 Console.WriteLine("准备就绪"); 23 while (true) 24 { 25 Console.ReadLine(); 26 Console.WriteLine("注册登录"); 27 test(); 28 Console.ReadLine(); 29 Console.WriteLine("缓存登录"); 30 test2(); 31 } 32 Console.ReadLine(); 33 } test() 37 { 38 Program.idList.Clear(); 39 int tcount = 2; 40 for (int i = 1; i <= tcount; i++) 41 { 42 new Thread(() => 43 { 44 System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); 45 watch.Start(); 46 int id = ids.GetId(); 47 Program.idList.Add(id); 48 string ret = HttpClient.UrlGet("http://192.168.2.235:7073/login?platform=100&channel=100&username=" + (id) + "&password=1&version=1&mac64=jdjdjjd&os=ios&fr=0202125"); 49 watch.Stop(); 50 Console.WriteLine(watch.ElapsedMilliseconds); 51 }).Start(); 52 } 53 } test2() 56 { 57 int tcount = Program.idList.Count; (int i = 0; i < tcount; i++) 60 { 61 new Thread(new ParameterizedThreadStart((object obj) => 62 { 63 System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); 64 watch.Start(); 65 string ret = HttpClient.UrlGet("http://192.168.2.235:7073/login?platform=100&channel=100&username=" + (obj) + "&password=1&version=1&mac64=jdjdjjd&os=ios&fr=0202125"); 66 watch.Stop(); 67 Console.WriteLine(watch.ElapsedMilliseconds); 68 })).Start(Program.idList[i]); 69 } 70 } 71 } 72 73 }
View Code
测试结果: