mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Delay insertion of postponed plot items.
This further reduces number of memmoves that need to be performed on a vector, which results in net increased throughput.
This commit is contained in:
parent
75e3dd175a
commit
c28b3a420f
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <chrono>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -1042,6 +1043,7 @@ void View::InsertPlot( PlotData* plot, PlotItem* item )
|
|||||||
{
|
{
|
||||||
if( plot->min > val ) plot->min = val;
|
if( plot->min > val ) plot->min = val;
|
||||||
else if( plot->max < val ) plot->max = val;
|
else if( plot->max < val ) plot->max = val;
|
||||||
|
if( plot->postpone.empty() ) plot->postponeTime = std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
|
||||||
plot->postpone.push_back( item );
|
plot->postpone.push_back( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1082,6 +1084,7 @@ void View::HandlePostponedPlots()
|
|||||||
{
|
{
|
||||||
auto& src = plot->postpone;
|
auto& src = plot->postpone;
|
||||||
if( src.empty() ) continue;
|
if( src.empty() ) continue;
|
||||||
|
if( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count() - plot->postponeTime < 100 ) continue;
|
||||||
auto& dst = plot->data;
|
auto& dst = plot->data;
|
||||||
std::sort( src.begin(), src.end(), [] ( const auto& l, const auto& r ) { return l->time < r->time; } );
|
std::sort( src.begin(), src.end(), [] ( const auto& l, const auto& r ) { return l->time < r->time; } );
|
||||||
const auto ds = std::lower_bound( dst.begin(), dst.end(), src.front()->time, [] ( const auto& l, const auto& r ) { return l->time < r; } );
|
const auto ds = std::lower_bound( dst.begin(), dst.end(), src.front()->time, [] ( const auto& l, const auto& r ) { return l->time < r; } );
|
||||||
|
|||||||
@ -101,6 +101,7 @@ private:
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
Vector<PlotItem*> data;
|
Vector<PlotItem*> data;
|
||||||
Vector<PlotItem*> postpone;
|
Vector<PlotItem*> postpone;
|
||||||
|
uint64_t postponeTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Worker();
|
void Worker();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user