|
|
@@ -17,12 +17,15 @@ namespace Model
|
|
|
{
|
|
|
private int k;
|
|
|
|
|
|
- public void Awake(string address)
|
|
|
+ private long time1 = TimeHelper.ClientNowTicks();
|
|
|
+
|
|
|
+ public async void Awake(string address)
|
|
|
{
|
|
|
NetOuterComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
|
|
|
|
|
|
- for (int i = 0; i < 400; i++)
|
|
|
+ for (int i = 0; i < 100; i++)
|
|
|
{
|
|
|
+ await Game.Scene.GetComponent<TimerComponent>().WaitAsync(10);
|
|
|
TestAsync(networkComponent, address, i);
|
|
|
}
|
|
|
}
|
|
|
@@ -32,22 +35,20 @@ namespace Model
|
|
|
using (Session session = networkComponent.Create(address))
|
|
|
{
|
|
|
int i = 0;
|
|
|
- while (i < 10000)
|
|
|
+ while (i < 10000000)
|
|
|
{
|
|
|
++i;
|
|
|
try
|
|
|
{
|
|
|
- R2C_Login s2CLogin = await session.Call<C2R_Login, R2C_Login>(new C2R_Login { Account = "abcdef", Password = "111111" });
|
|
|
-
|
|
|
- using (Session gateSession = networkComponent.Create(s2CLogin.Address))
|
|
|
- {
|
|
|
- await gateSession.Call<C2G_LoginGate, G2C_LoginGate>(new C2G_LoginGate(s2CLogin.Key));
|
|
|
- }
|
|
|
+ await session.Call<C2R_Ping, R2C_Ping>(new C2R_Ping());
|
|
|
|
|
|
++this.k;
|
|
|
- if (this.k % 1000 == 0)
|
|
|
+ if (this.k % 100000 == 0)
|
|
|
{
|
|
|
- Log.Info($"{j} Benchmark k: {k}");
|
|
|
+ long time2 = TimeHelper.ClientNowTicks();
|
|
|
+ long time = time2 - this.time1;
|
|
|
+ this.time1 = time2;
|
|
|
+ Log.Info($"{j} Benchmark k: {k} 每10W次耗时: {time}");
|
|
|
}
|
|
|
}
|
|
|
catch (RpcException e)
|