BenchmarkClientComponentSystem.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Collections.Generic;
  2. using System.Net.Sockets;
  3. using System.Threading.Tasks;
  4. namespace ET.Server
  5. {
  6. public static class BenchmarkClientComponentSystem
  7. {
  8. public class AwakeSystem: AwakeSystem<BenchmarkClientComponent>
  9. {
  10. protected override void Awake(BenchmarkClientComponent self)
  11. {
  12. for (int i = 0; i < 50; ++i)
  13. {
  14. self.Start().Coroutine();
  15. }
  16. }
  17. }
  18. private static async ETTask Start(this BenchmarkClientComponent self)
  19. {
  20. await Task.CompletedTask;
  21. // await TimerComponent.Instance.WaitAsync(1000);
  22. //
  23. // Scene scene = await SceneFactory.CreateServerScene(self, IdGenerater.Instance.GenerateId(), IdGenerater.Instance.GenerateInstanceId(),
  24. // self.DomainZone(), "bechmark", SceneType.Benchmark);
  25. //
  26. // NetClientComponent netClientComponent = scene.AddComponent<NetClientComponent, AddressFamily>(AddressFamily.InterNetwork);
  27. //
  28. // using Session session = netClientComponent.Create(StartSceneConfigCategory.Instance.BenchmarkServer.OuterIPPort);
  29. // List<ETTask> list = new List<ETTask>(100000);
  30. //
  31. // async ETTask Call(Session s)
  32. // {
  33. // await s.Call(new C2G_Benchmark());
  34. // }
  35. //
  36. // for (int j = 0; j < 100000000; ++j)
  37. // {
  38. // list.Clear();
  39. // for (int i = 0; i < list.Capacity; ++i)
  40. // {
  41. // list.Add(Call(session));
  42. // }
  43. // await ETTaskHelper.WaitAll(list);
  44. // }
  45. }
  46. }
  47. }