| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections.Generic;
- using System.Net.Sockets;
- using ET.Client;
- namespace ET.Server
- {
- [EntitySystemOf(typeof(BenchmarkClientComponent))]
- public static partial class BenchmarkClientComponentSystem
- {
- [EntitySystem]
- private static void Awake(this BenchmarkClientComponent self)
- {
- for (int i = 0; i < 10; ++i)
- {
- self.Start().Coroutine();
- }
- }
- private static async ETTask Start(this BenchmarkClientComponent self)
- {
- NetOuterComponent netOuterClientComponent = self.Root().GetComponent<NetOuterComponent>();
- using Session session = netOuterClientComponent.Create(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort);
- List<ETTask> list = new List<ETTask>(100000);
- async ETTask Call(Session s)
- {
- using G2C_Benchmark benchmark = await s.Call(C2G_Benchmark.Create()) as G2C_Benchmark;
- }
-
- for (int j = 0; j < 100000000; ++j)
- {
- list.Clear();
- for (int i = 0; i < list.Capacity; ++i)
- {
- list.Add(Call(session));
- }
- await ETTaskHelper.WaitAll(list);
- }
- }
- }
- }
|