mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Don't show drift adjustment for calibrated GPU contexts.
This commit is contained in:
parent
21f4981f38
commit
a3c51f0e7e
@ -7906,80 +7906,83 @@ void View::DrawOptions()
|
|||||||
{
|
{
|
||||||
ImGui::TextDisabled( "%s threads", RealToString( gpuData[i]->threadData.size() ) );
|
ImGui::TextDisabled( "%s threads", RealToString( gpuData[i]->threadData.size() ) );
|
||||||
}
|
}
|
||||||
ImGui::TreePush();
|
if( !gpuData[i]->hasCalibration )
|
||||||
auto& drift = GpuDrift( gpuData[i] );
|
|
||||||
ImGui::SetNextItemWidth( 120 );
|
|
||||||
ImGui::PushID( i );
|
|
||||||
ImGui::InputInt( "Drift (ns/s)", &drift );
|
|
||||||
ImGui::PopID();
|
|
||||||
if( timeline.size() > 1 )
|
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::TreePush();
|
||||||
if( ImGui::Button( ICON_FA_ROBOT " Auto" ) )
|
auto& drift = GpuDrift( gpuData[i] );
|
||||||
|
ImGui::SetNextItemWidth( 120 );
|
||||||
|
ImGui::PushID( i );
|
||||||
|
ImGui::InputInt( "Drift (ns/s)", &drift );
|
||||||
|
ImGui::PopID();
|
||||||
|
if( timeline.size() > 1 )
|
||||||
{
|
{
|
||||||
size_t lastidx = 0;
|
ImGui::SameLine();
|
||||||
if( timeline.is_magic() )
|
if( ImGui::Button( ICON_FA_ROBOT " Auto" ) )
|
||||||
{
|
{
|
||||||
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
size_t lastidx = 0;
|
||||||
for( size_t j=tl.size()-1; j > 0; j-- )
|
if( timeline.is_magic() )
|
||||||
{
|
{
|
||||||
if( tl[j].GpuEnd() >= 0 )
|
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
||||||
|
for( size_t j=tl.size()-1; j > 0; j-- )
|
||||||
{
|
{
|
||||||
lastidx = j;
|
if( tl[j].GpuEnd() >= 0 )
|
||||||
break;
|
{
|
||||||
|
lastidx = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
for( size_t j=timeline.size()-1; j > 0; j-- )
|
|
||||||
{
|
{
|
||||||
if( timeline[j]->GpuEnd() >= 0 )
|
for( size_t j=timeline.size()-1; j > 0; j-- )
|
||||||
{
|
{
|
||||||
lastidx = j;
|
if( timeline[j]->GpuEnd() >= 0 )
|
||||||
break;
|
{
|
||||||
|
lastidx = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum { NumSlopes = 10000 };
|
enum { NumSlopes = 10000 };
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
std::default_random_engine gen( rd() );
|
std::default_random_engine gen( rd() );
|
||||||
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() )
|
if( timeline.is_magic() )
|
||||||
{
|
|
||||||
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
const auto p0 = dist( gen );
|
auto& tl = *((Vector<GpuEvent>*)&timeline);
|
||||||
const auto p1 = dist( gen );
|
do
|
||||||
if( p0 != p1 )
|
|
||||||
{
|
{
|
||||||
slopes[idx++] = float( 1.0 - double( tl[p1].GpuStart() - tl[p0].GpuStart() ) / double( tl[p1].CpuStart() - tl[p0].CpuStart() ) );
|
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 );
|
||||||
}
|
}
|
||||||
while( idx < NumSlopes );
|
else
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
const auto p0 = dist( gen );
|
do
|
||||||
const auto p1 = dist( gen );
|
|
||||||
if( p0 != p1 )
|
|
||||||
{
|
{
|
||||||
slopes[idx++] = float( 1.0 - double( timeline[p1]->GpuStart() - timeline[p0]->GpuStart() ) / double( timeline[p1]->CpuStart() - timeline[p0]->CpuStart() ) );
|
const auto p0 = dist( gen );
|
||||||
|
const auto p1 = dist( gen );
|
||||||
|
if( p0 != p1 )
|
||||||
|
{
|
||||||
|
slopes[idx++] = float( 1.0 - double( timeline[p1]->GpuStart() - timeline[p0]->GpuStart() ) / double( timeline[p1]->CpuStart() - timeline[p0]->CpuStart() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
while( idx < NumSlopes );
|
||||||
}
|
}
|
||||||
while( idx < NumSlopes );
|
std::sort( slopes, slopes+NumSlopes );
|
||||||
|
drift = int( 1000000000 * -slopes[NumSlopes/2] );
|
||||||
}
|
}
|
||||||
std::sort( slopes, slopes+NumSlopes );
|
|
||||||
drift = int( 1000000000 * -slopes[NumSlopes/2] );
|
|
||||||
}
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user