mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Use TimelineContext to draw CPU zones.
This commit is contained in:
parent
ee5d6f1adb
commit
6ab4180b5b
@ -229,7 +229,7 @@ void TimelineItemThread::HeaderTooltip( const char* label ) const
|
|||||||
|
|
||||||
void TimelineItemThread::HeaderExtraContents( const TimelineContext& ctx, int offset, float labelWidth )
|
void TimelineItemThread::HeaderExtraContents( const TimelineContext& ctx, int offset, float labelWidth )
|
||||||
{
|
{
|
||||||
m_view.DrawThreadMessages( *m_thread, ctx.pxns, offset, ctx.wpos, ctx.hover );
|
m_view.DrawThreadMessages( ctx, *m_thread, offset );
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
const bool hasGhostZones = m_worker.AreGhostZonesReady() && !m_thread->ghostZones.empty();
|
const bool hasGhostZones = m_worker.AreGhostZonesReady() && !m_thread->ghostZones.empty();
|
||||||
@ -255,7 +255,7 @@ void TimelineItemThread::HeaderExtraContents( const TimelineContext& ctx, int of
|
|||||||
|
|
||||||
bool TimelineItemThread::DrawContents( const TimelineContext& ctx, int& offset )
|
bool TimelineItemThread::DrawContents( const TimelineContext& ctx, int& offset )
|
||||||
{
|
{
|
||||||
const auto res = m_view.DrawThread( *m_thread, ctx.pxns, offset, ctx.wpos, ctx.hover, ctx.yMin, ctx.yMax, m_ghost );
|
const auto res = m_view.DrawThread( ctx, *m_thread, offset, m_ghost );
|
||||||
if( !res )
|
if( !res )
|
||||||
{
|
{
|
||||||
auto& crash = m_worker.GetCrashEvent();
|
auto& crash = m_worker.GetCrashEvent();
|
||||||
|
@ -121,8 +121,8 @@ public:
|
|||||||
void HighlightThread( uint64_t thread );
|
void HighlightThread( uint64_t thread );
|
||||||
void ZoomToRange( int64_t start, int64_t end, bool pause = true );
|
void ZoomToRange( int64_t start, int64_t end, bool pause = true );
|
||||||
bool DrawPlot( const TimelineContext& ctx, PlotData& plot, int& offset );
|
bool DrawPlot( const TimelineContext& ctx, PlotData& plot, int& offset );
|
||||||
bool DrawThread( const ThreadData& thread, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax, bool ghostMode );
|
bool DrawThread( const TimelineContext& ctx, const ThreadData& thread, int& offset, bool ghostMode );
|
||||||
void DrawThreadMessages( const ThreadData& thread, double pxns, int offset, const ImVec2& wpos, bool hover );
|
void DrawThreadMessages( const TimelineContext& ctx, const ThreadData& thread, int offset );
|
||||||
void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr );
|
void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr );
|
||||||
bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset );
|
bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset );
|
||||||
bool DrawCpuData( const TimelineContext& ctx, int& offset );
|
bool DrawCpuData( const TimelineContext& ctx, int& offset );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "TracyImGui.hpp"
|
#include "TracyImGui.hpp"
|
||||||
#include "TracyMouse.hpp"
|
#include "TracyMouse.hpp"
|
||||||
#include "TracyPrint.hpp"
|
#include "TracyPrint.hpp"
|
||||||
#include "TracyTimelineItem.hpp"
|
#include "TracyTimelineContext.hpp"
|
||||||
#include "TracyView.hpp"
|
#include "TracyView.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
@ -22,11 +22,16 @@ static tracy_force_inline uint32_t MixGhostColor( uint32_t c0, uint32_t c1 )
|
|||||||
( ( ( ( ( c0 & 0x000000FF ) ) + 3 * ( ( c1 & 0x000000FF ) ) ) >> 2 ) );
|
( ( ( ( ( c0 & 0x000000FF ) ) + 3 * ( ( c1 & 0x000000FF ) ) ) >> 2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool View::DrawThread( const ThreadData& thread, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax, bool ghostMode )
|
bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, int& offset, bool ghostMode )
|
||||||
{
|
{
|
||||||
const auto ty = ImGui::GetTextLineHeight();
|
const auto& wpos = ctx.wpos;
|
||||||
|
const auto ty = ctx.ty;
|
||||||
const auto ostep = ty + 1;
|
const auto ostep = ty + 1;
|
||||||
const auto nspx = 1.0 / pxns;
|
const auto pxns = ctx.pxns;
|
||||||
|
const auto nspx = ctx.nspx;
|
||||||
|
const auto hover = ctx.hover;
|
||||||
|
const auto yMin = ctx.yMin;
|
||||||
|
const auto yMax = ctx.yMax;
|
||||||
|
|
||||||
ImGui::PushFont( m_smallFont );
|
ImGui::PushFont( m_smallFont );
|
||||||
const auto sty = ImGui::GetTextLineHeight();
|
const auto sty = ImGui::GetTextLineHeight();
|
||||||
@ -97,14 +102,18 @@ bool View::DrawThread( const ThreadData& thread, double pxns, int& offset, const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawThreadMessages( const ThreadData& thread, double pxns, int offset, const ImVec2& wpos, bool hover )
|
void View::DrawThreadMessages( const TimelineContext& ctx, const ThreadData& thread, int offset )
|
||||||
{
|
{
|
||||||
const auto nspx = 1.0 / pxns;
|
const auto& wpos = ctx.wpos;
|
||||||
auto draw = ImGui::GetWindowDrawList();
|
const auto pxns = ctx.pxns;
|
||||||
const auto ty = ImGui::GetTextLineHeight();
|
const auto nspx = ctx.nspx;
|
||||||
|
const auto hover = ctx.hover;
|
||||||
|
const auto ty = ctx.ty;
|
||||||
const auto to = 9.f * GetScale();
|
const auto to = 9.f * GetScale();
|
||||||
const auto th = ( ty - to ) * sqrt( 3 ) * 0.5;
|
const auto th = ( ty - to ) * sqrt( 3 ) * 0.5;
|
||||||
|
|
||||||
|
auto draw = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
auto msgit = std::lower_bound( thread.messages.begin(), thread.messages.end(), m_vd.zvStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
auto msgit = std::lower_bound( thread.messages.begin(), thread.messages.end(), m_vd.zvStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
||||||
auto msgend = std::lower_bound( msgit, thread.messages.end(), m_vd.zvEnd+1, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
auto msgend = std::lower_bound( msgit, thread.messages.end(), m_vd.zvEnd+1, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user