mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Monitor send queue size.
This commit is contained in:
parent
3c49dea10c
commit
edad2d7e35
@ -805,6 +805,13 @@ private:
|
||||
bool groupTopDown = true;
|
||||
} m_sampleParents;
|
||||
|
||||
struct
|
||||
{
|
||||
bool enabled = false;
|
||||
bool monitor = false;
|
||||
int64_t time;
|
||||
} m_sendQueueWarning;
|
||||
|
||||
std::vector<std::pair<int, int>> m_cpuUsageBuf;
|
||||
};
|
||||
|
||||
|
@ -10,12 +10,17 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
constexpr size_t SendQueueEnableThreshold = 1000000;
|
||||
constexpr size_t SendQueueDisableThreshold = 500000;
|
||||
constexpr int64_t SendQueueTimespanMs = 10000; // 10 s
|
||||
|
||||
bool View::DrawConnection()
|
||||
{
|
||||
const auto scale = GetScale();
|
||||
const auto ty = ImGui::GetTextLineHeight();
|
||||
const auto cs = ty * 0.9f;
|
||||
const auto isConnected = m_worker.IsConnected();
|
||||
size_t sendQueue;
|
||||
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock( m_worker.GetMbpsDataLock() );
|
||||
@ -42,7 +47,36 @@ bool View::DrawConnection()
|
||||
ImGui::SameLine();
|
||||
ImGui::Text( "%6.2f Mbps", mbps / m_worker.GetCompRatio() );
|
||||
TextFocused( "Data transferred:", MemSizeToString( m_worker.GetDataTransferred() ) );
|
||||
TextFocused( "Query backlog:", RealToString( m_worker.GetSendQueueSize() ) );
|
||||
sendQueue = m_worker.GetSendQueueSize();
|
||||
TextFocused( "Query backlog:", RealToString( sendQueue ) );
|
||||
}
|
||||
|
||||
if( !m_sendQueueWarning.enabled )
|
||||
{
|
||||
if( !m_sendQueueWarning.monitor )
|
||||
{
|
||||
if( sendQueue > SendQueueEnableThreshold )
|
||||
{
|
||||
m_sendQueueWarning.monitor = true;
|
||||
m_sendQueueWarning.time = std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now().time_since_epoch() ).count();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sendQueue < SendQueueDisableThreshold )
|
||||
{
|
||||
m_sendQueueWarning.monitor = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto t = std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now().time_since_epoch() ).count();
|
||||
if( t - m_sendQueueWarning.time > SendQueueTimespanMs )
|
||||
{
|
||||
m_sendQueueWarning.enabled = true;
|
||||
m_sendQueueWarning.monitor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto wpos = ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin();
|
||||
|
Loading…
Reference in New Issue
Block a user