diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 286c9d39..f1586544 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -11,6 +11,7 @@ #include "../common/TracyProtocol.hpp" #include "../common/TracySystem.hpp" #include "../common/TracyQueue.hpp" +#include "../imgui/imgui.h" #include "TracyView.hpp" namespace tracy @@ -259,4 +260,29 @@ void View::UpdateZone( uint64_t idx ) assert( zone.end != -1 ); } +void View::Draw() +{ + s_instance->DrawImpl(); +} + +void View::DrawImpl() +{ + // Connection window + { + const auto mbps = m_mbps.back(); + char buf[64]; + if( mbps < 0.1f ) + { + sprintf( buf, "%.2f Kbps", mbps * 1000.f ); + } + else + { + sprintf( buf, "%.2f Mbps", mbps ); + } + ImGui::Begin( m_addr.c_str() ); + ImGui::PlotLines( buf, m_mbps.data(), m_mbps.size(), 0, nullptr, 0 ); + ImGui::End(); + } +} + } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index a40a0a8a..e4642073 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -26,6 +26,7 @@ public: ~View(); static bool ShouldExit(); + static void Draw(); private: void Worker(); @@ -43,6 +44,8 @@ private: void NewZone( uint64_t idx ); void UpdateZone( uint64_t idx ); + void DrawImpl(); + std::string m_addr; Socket m_sock;