From 39bb9a3ad1b5a5f4740290492004e24792ce373a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 4 Oct 2017 19:24:24 +0200 Subject: [PATCH] Insert lock events into timeline. --- server/TracyView.cpp | 11 ++++++++++- server/TracyView.hpp | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1db48e54..b519beca 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -676,8 +676,17 @@ void View::InsertZone( Event* zone, Event* parent, Vector& vec ) } } -void View::InsertLockEvent( Vector& timeline, const LockEvent* lev ) +void View::InsertLockEvent( Vector& timeline, LockEvent* lev ) { + if( timeline.empty() || timeline.back()->time < lev->time ) + { + timeline.push_back( lev ); + } + else + { + auto it = std::lower_bound( timeline.begin(), timeline.end(), lev->time, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } ); + timeline.insert( it, lev ); + } } uint64_t View::GetFrameTime( size_t idx ) const diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 2f5e01a7..c754804d 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -84,7 +84,7 @@ private: void InsertZone( Event* zone, Event* parent, Vector& vec ); - void InsertLockEvent( Vector& timeline, const LockEvent* lev ); + void InsertLockEvent( Vector& timeline, LockEvent* lev ); uint64_t GetFrameTime( size_t idx ) const; uint64_t GetFrameBegin( size_t idx ) const;