mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Also move timeline samples.
This commit is contained in:
parent
e005d4ff36
commit
c6b6cb47da
@ -2735,88 +2735,6 @@ void View::DrawZones()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset )
|
|
||||||
{
|
|
||||||
auto it = std::lower_bound( vec.begin(), vec.end(), m_vd.zvStart, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
|
||||||
if( it == vec.end() ) return;
|
|
||||||
const auto itend = std::lower_bound( it, vec.end(), m_vd.zvEnd, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
|
||||||
if( it == itend ) return;
|
|
||||||
|
|
||||||
const auto ty0375 = offset + round( ImGui::GetTextLineHeight() * 0.375f );
|
|
||||||
const auto ty02 = round( ImGui::GetTextLineHeight() * 0.2f );
|
|
||||||
const auto ty01 = round( ImGui::GetTextLineHeight() * 0.1f );
|
|
||||||
const auto y0 = ty0375 - ty02 - 3;
|
|
||||||
const auto y1 = ty0375 + ty02 - 1;
|
|
||||||
auto draw = ImGui::GetWindowDrawList();
|
|
||||||
|
|
||||||
const auto MinVis = 6 * GetScale();
|
|
||||||
bool tooltipDisplayed = false;
|
|
||||||
|
|
||||||
while( it < itend )
|
|
||||||
{
|
|
||||||
bool visible = true;
|
|
||||||
const auto px0 = ( it->time.Val() - m_vd.zvStart ) * pxns;
|
|
||||||
double px1;
|
|
||||||
auto next = it+1;
|
|
||||||
int num;
|
|
||||||
if( next != itend )
|
|
||||||
{
|
|
||||||
auto px1ns = next->time.Val() - m_vd.zvStart;
|
|
||||||
px1 = px1ns * pxns;
|
|
||||||
if( px1 - px0 < MinVis )
|
|
||||||
{
|
|
||||||
const auto MinVisNs = MinVis * nspx;
|
|
||||||
visible = false;
|
|
||||||
auto nextTime = px0 + MinVisNs;
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
const auto prev = next;
|
|
||||||
next = std::lower_bound( next, itend, nextTime, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
|
||||||
if( prev == next ) ++next;
|
|
||||||
if( next == itend ) break;
|
|
||||||
const auto nsnext = next->time.Val() - m_vd.zvStart;
|
|
||||||
if( nsnext - px1ns >= MinVisNs ) break;
|
|
||||||
px1ns = nsnext;
|
|
||||||
nextTime = next->time.Val() + nspx;
|
|
||||||
}
|
|
||||||
num = next - it;
|
|
||||||
px1 = px1ns * pxns;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( visible )
|
|
||||||
{
|
|
||||||
draw->AddCircleFilled( wpos + ImVec2( px0, ty0375 ), ty02, 0xFFDD8888 );
|
|
||||||
if( !tooltipDisplayed && hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px0 - ty02 - 2, y0 ), wpos + ImVec2( px0 + ty02 + 1, y1 ) ) )
|
|
||||||
{
|
|
||||||
tooltipDisplayed = true;
|
|
||||||
CallstackTooltip( it->callstack.Val() );
|
|
||||||
if( IsMouseClicked( 0 ) )
|
|
||||||
{
|
|
||||||
m_callstackInfoWindow = it->callstack.Val();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawZigZag( draw, wpos + ImVec2( 0, ty0375 ), px0, std::max( px1, px0+MinVis ), ty01, 0xFF997777 );
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px0, y0 ), wpos + ImVec2( std::max( px1, px0+MinVis ), y1 ) ) )
|
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::TextUnformatted( "Multiple call stack samples" );
|
|
||||||
TextFocused( "Number of samples:", RealToString( num ) );
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
|
|
||||||
if( IsMouseClicked( 2 ) )
|
|
||||||
{
|
|
||||||
const auto prev = next-1;
|
|
||||||
ZoomToRange( it->time.Val(), prev->time.Val() + 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
it = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
int View::DispatchGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax, uint64_t tid )
|
int View::DispatchGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax, uint64_t tid )
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "TracyFilesystem.hpp"
|
#include "TracyFilesystem.hpp"
|
||||||
|
#include "TracyMouse.hpp"
|
||||||
#include "TracyPrint.hpp"
|
#include "TracyPrint.hpp"
|
||||||
#include "TracySourceView.hpp"
|
#include "TracySourceView.hpp"
|
||||||
#include "TracyView.hpp"
|
#include "TracyView.hpp"
|
||||||
@ -8,6 +9,88 @@
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void View::DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset )
|
||||||
|
{
|
||||||
|
auto it = std::lower_bound( vec.begin(), vec.end(), m_vd.zvStart, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||||
|
if( it == vec.end() ) return;
|
||||||
|
const auto itend = std::lower_bound( it, vec.end(), m_vd.zvEnd, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||||
|
if( it == itend ) return;
|
||||||
|
|
||||||
|
const auto ty0375 = offset + round( ImGui::GetTextLineHeight() * 0.375f );
|
||||||
|
const auto ty02 = round( ImGui::GetTextLineHeight() * 0.2f );
|
||||||
|
const auto ty01 = round( ImGui::GetTextLineHeight() * 0.1f );
|
||||||
|
const auto y0 = ty0375 - ty02 - 3;
|
||||||
|
const auto y1 = ty0375 + ty02 - 1;
|
||||||
|
auto draw = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
|
const auto MinVis = 6 * GetScale();
|
||||||
|
bool tooltipDisplayed = false;
|
||||||
|
|
||||||
|
while( it < itend )
|
||||||
|
{
|
||||||
|
bool visible = true;
|
||||||
|
const auto px0 = ( it->time.Val() - m_vd.zvStart ) * pxns;
|
||||||
|
double px1;
|
||||||
|
auto next = it+1;
|
||||||
|
int num;
|
||||||
|
if( next != itend )
|
||||||
|
{
|
||||||
|
auto px1ns = next->time.Val() - m_vd.zvStart;
|
||||||
|
px1 = px1ns * pxns;
|
||||||
|
if( px1 - px0 < MinVis )
|
||||||
|
{
|
||||||
|
const auto MinVisNs = MinVis * nspx;
|
||||||
|
visible = false;
|
||||||
|
auto nextTime = px0 + MinVisNs;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
const auto prev = next;
|
||||||
|
next = std::lower_bound( next, itend, nextTime, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||||
|
if( prev == next ) ++next;
|
||||||
|
if( next == itend ) break;
|
||||||
|
const auto nsnext = next->time.Val() - m_vd.zvStart;
|
||||||
|
if( nsnext - px1ns >= MinVisNs ) break;
|
||||||
|
px1ns = nsnext;
|
||||||
|
nextTime = next->time.Val() + nspx;
|
||||||
|
}
|
||||||
|
num = next - it;
|
||||||
|
px1 = px1ns * pxns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( visible )
|
||||||
|
{
|
||||||
|
draw->AddCircleFilled( wpos + ImVec2( px0, ty0375 ), ty02, 0xFFDD8888 );
|
||||||
|
if( !tooltipDisplayed && hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px0 - ty02 - 2, y0 ), wpos + ImVec2( px0 + ty02 + 1, y1 ) ) )
|
||||||
|
{
|
||||||
|
tooltipDisplayed = true;
|
||||||
|
CallstackTooltip( it->callstack.Val() );
|
||||||
|
if( IsMouseClicked( 0 ) )
|
||||||
|
{
|
||||||
|
m_callstackInfoWindow = it->callstack.Val();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawZigZag( draw, wpos + ImVec2( 0, ty0375 ), px0, std::max( px1, px0+MinVis ), ty01, 0xFF997777 );
|
||||||
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px0, y0 ), wpos + ImVec2( std::max( px1, px0+MinVis ), y1 ) ) )
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::TextUnformatted( "Multiple call stack samples" );
|
||||||
|
TextFocused( "Number of samples:", RealToString( num ) );
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
|
||||||
|
if( IsMouseClicked( 2 ) )
|
||||||
|
{
|
||||||
|
const auto prev = next-1;
|
||||||
|
ZoomToRange( it->time.Val(), prev->time.Val() + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, AccumulationMode accumulationMode )
|
void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, AccumulationMode accumulationMode )
|
||||||
{
|
{
|
||||||
static unordered_flat_map<uint64_t, SymList> inlineMap;
|
static unordered_flat_map<uint64_t, SymList> inlineMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user