mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 21:23:52 +00:00
Handle postponed samples with SortedVector.
This commit is contained in:
parent
590a4afb89
commit
710a488af0
@ -264,6 +264,8 @@ struct SampleData
|
|||||||
|
|
||||||
enum { SampleDataSize = sizeof( SampleData ) };
|
enum { SampleDataSize = sizeof( SampleData ) };
|
||||||
|
|
||||||
|
struct SampleDataSort { bool operator()( const SampleData& lhs, const SampleData& rhs ) { return lhs.time.Val() < rhs.time.Val(); }; };
|
||||||
|
|
||||||
|
|
||||||
struct SampleDataRange
|
struct SampleDataRange
|
||||||
{
|
{
|
||||||
@ -633,7 +635,7 @@ struct ThreadData
|
|||||||
Vector<int64_t> childTimeStack;
|
Vector<int64_t> childTimeStack;
|
||||||
Vector<GhostZone> ghostZones;
|
Vector<GhostZone> ghostZones;
|
||||||
uint64_t ghostIdx;
|
uint64_t ghostIdx;
|
||||||
Vector<SampleData> postponedSamples;
|
SortedVector<SampleData, SampleDataSort> postponedSamples;
|
||||||
#endif
|
#endif
|
||||||
Vector<SampleData> samples;
|
Vector<SampleData> samples;
|
||||||
SampleData pendingSample;
|
SampleData pendingSample;
|
||||||
|
@ -4358,11 +4358,7 @@ void Worker::DoPostponedWork()
|
|||||||
auto ctx = GetContextSwitchData( td->id );
|
auto ctx = GetContextSwitchData( td->id );
|
||||||
if( ctx )
|
if( ctx )
|
||||||
{
|
{
|
||||||
#ifdef NO_PARALLEL_SORT
|
td->postponedSamples.ensure_sorted();
|
||||||
pdqsort_branchless( td->postponedSamples.begin(), td->postponedSamples.end(), [] ( const auto& l, const auto& r ) { return l.time.Val() < r.time.Val(); } );
|
|
||||||
#else
|
|
||||||
std::sort( std::execution::par_unseq, td->postponedSamples.begin(), td->postponedSamples.end(), [] ( const auto& l, const auto& r ) { return l.time.Val() < r.time.Val(); } );
|
|
||||||
#endif
|
|
||||||
auto sit = td->postponedSamples.begin();
|
auto sit = td->postponedSamples.begin();
|
||||||
auto cit = std::lower_bound( ctx->v.begin(), ctx->v.end(), sit->time.Val(), [] ( const auto& l, const auto& r ) { return (uint64_t)l.End() < (uint64_t)r; } );
|
auto cit = std::lower_bound( ctx->v.begin(), ctx->v.end(), sit->time.Val(), [] ( const auto& l, const auto& r ) { return (uint64_t)l.End() < (uint64_t)r; } );
|
||||||
if( cit != ctx->v.end() )
|
if( cit != ctx->v.end() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user