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) { NetClientComponent netClientComponent = self.Root().GetComponent(); using Session session = netClientComponent.Create(StartSceneConfigCategory.Instance.Benchmark.OuterIPPort); List list = new List(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); } } } }