Display throughput plot.

This commit is contained in:
Bartosz Taudul 2017-09-15 02:30:22 +02:00
parent d7c09605d6
commit 74f692c254
2 changed files with 29 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "../common/TracyProtocol.hpp" #include "../common/TracyProtocol.hpp"
#include "../common/TracySystem.hpp" #include "../common/TracySystem.hpp"
#include "../common/TracyQueue.hpp" #include "../common/TracyQueue.hpp"
#include "../imgui/imgui.h"
#include "TracyView.hpp" #include "TracyView.hpp"
namespace tracy namespace tracy
@ -259,4 +260,29 @@ void View::UpdateZone( uint64_t idx )
assert( zone.end != -1 ); 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();
}
}
} }

View File

@ -26,6 +26,7 @@ public:
~View(); ~View();
static bool ShouldExit(); static bool ShouldExit();
static void Draw();
private: private:
void Worker(); void Worker();
@ -43,6 +44,8 @@ private:
void NewZone( uint64_t idx ); void NewZone( uint64_t idx );
void UpdateZone( uint64_t idx ); void UpdateZone( uint64_t idx );
void DrawImpl();
std::string m_addr; std::string m_addr;
Socket m_sock; Socket m_sock;