MultiplayerDebugNetworkMetrics.h 921 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Name/Name.h>
  10. #include <AzCore/Component/Entity.h>
  11. #ifdef IMGUI_ENABLED
  12. # include <imgui/imgui.h>
  13. # include <ImGuiBus.h>
  14. # include <LYImGuiUtils/HistogramContainer.h>
  15. #endif
  16. namespace Multiplayer
  17. {
  18. class MultiplayerDebugNetworkMetrics final
  19. {
  20. public:
  21. #ifdef IMGUI_ENABLED
  22. void OnImGuiUpdate();
  23. private:
  24. struct NetworkMetricDisplay
  25. {
  26. int64_t m_lastValue = 0;
  27. ImGui::LYImGuiUtils::HistogramContainer m_histogram;
  28. };
  29. AZStd::unordered_map<AZ::Name, NetworkMetricDisplay> m_sendHistograms;
  30. AZStd::unordered_map<AZ::Name, NetworkMetricDisplay> m_recvHistograms;
  31. #endif
  32. };
  33. }