mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Magic vectors in automatic GPU drift detection.
This commit is contained in:
parent
1b6c79fa7b
commit
4eb8acc973
@ -7039,6 +7039,20 @@ void View::DrawOptions()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
size_t lastidx = 0;
|
size_t lastidx = 0;
|
||||||
|
if( timeline.is_magic() )
|
||||||
|
{
|
||||||
|
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
||||||
|
for( size_t j=tl.size()-1; j > 0; j-- )
|
||||||
|
{
|
||||||
|
if( tl[j].GpuEnd() >= 0 )
|
||||||
|
{
|
||||||
|
lastidx = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for( size_t j=timeline.size()-1; j > 0; j-- )
|
for( size_t j=timeline.size()-1; j > 0; j-- )
|
||||||
{
|
{
|
||||||
if( timeline[j]->GpuEnd() >= 0 )
|
if( timeline[j]->GpuEnd() >= 0 )
|
||||||
@ -7047,6 +7061,7 @@ void View::DrawOptions()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum { NumSlopes = 10000 };
|
enum { NumSlopes = 10000 };
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
@ -7054,6 +7069,22 @@ void View::DrawOptions()
|
|||||||
std::uniform_int_distribution<size_t> dist( 0, lastidx - 1 );
|
std::uniform_int_distribution<size_t> dist( 0, lastidx - 1 );
|
||||||
float slopes[NumSlopes];
|
float slopes[NumSlopes];
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
|
if( timeline.is_magic() )
|
||||||
|
{
|
||||||
|
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const auto p0 = dist( gen );
|
||||||
|
const auto p1 = dist( gen );
|
||||||
|
if( p0 != p1 )
|
||||||
|
{
|
||||||
|
slopes[idx++] = float( 1.0 - double( tl[p1].GpuStart() - tl[p0].GpuStart() ) / double( tl[p1].CpuStart() - tl[p0].CpuStart() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( idx < NumSlopes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const auto p0 = dist( gen );
|
const auto p0 = dist( gen );
|
||||||
@ -7064,6 +7095,7 @@ void View::DrawOptions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( idx < NumSlopes );
|
while( idx < NumSlopes );
|
||||||
|
}
|
||||||
std::sort( slopes, slopes+NumSlopes );
|
std::sort( slopes, slopes+NumSlopes );
|
||||||
drift = int( 1000000000 * -slopes[NumSlopes/2] );
|
drift = int( 1000000000 * -slopes[NumSlopes/2] );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user