Add frame target UI.

This commit is contained in:
Bartosz Taudul 2020-11-15 15:46:23 +01:00
parent b0e69b2e9f
commit 8a1d8e4bac
3 changed files with 20 additions and 1 deletions

View File

@ -21,7 +21,7 @@ constexpr auto FileAnnotations = "annotations";
constexpr auto FileSourceSubstitutions = "srcsub";
enum : uint32_t { VersionTimeline = 0 };
enum : uint32_t { VersionOptions = 6 };
enum : uint32_t { VersionOptions = 7 };
enum : uint32_t { VersionAnnotations = 0 };
enum : uint32_t { VersionSourceSubstitutions = 0 };
@ -102,6 +102,7 @@ void UserData::LoadState( ViewData& data )
fread( &data.drawPlots, 1, sizeof( data.drawPlots ), f );
fread( &data.onlyContendedLocks, 1, sizeof( data.onlyContendedLocks ), f );
fread( &data.drawEmptyLabels, 1, sizeof( data.drawEmptyLabels ), f );
fread( &data.drawFrameTargets, 1, sizeof( data.drawFrameTargets ), f );
fread( &data.drawContextSwitches, 1, sizeof( data.drawContextSwitches ), f );
fread( &data.darkenContextSwitches, 1, sizeof( data.darkenContextSwitches ), f );
fread( &data.drawCpuData, 1, sizeof( data.drawCpuData ), f );
@ -110,6 +111,7 @@ void UserData::LoadState( ViewData& data )
fread( &data.dynamicColors, 1, sizeof( data.dynamicColors ), f );
fread( &data.forceColors, 1, sizeof( data.forceColors ), f );
fread( &data.ghostZones, 1, sizeof( data.ghostZones ), f );
fread( &data.frameTarget, 1, sizeof( data.frameTarget ), f );
}
fclose( f );
}
@ -144,6 +146,7 @@ void UserData::SaveState( const ViewData& data )
fwrite( &data.drawPlots, 1, sizeof( data.drawPlots ), f );
fwrite( &data.onlyContendedLocks, 1, sizeof( data.onlyContendedLocks ), f );
fwrite( &data.drawEmptyLabels, 1, sizeof( data.drawEmptyLabels ), f );
fwrite( &data.drawFrameTargets, 1, sizeof( data.drawFrameTargets ), f );
fwrite( &data.drawContextSwitches, 1, sizeof( data.drawContextSwitches ), f );
fwrite( &data.darkenContextSwitches, 1, sizeof( data.darkenContextSwitches ), f );
fwrite( &data.drawCpuData, 1, sizeof( data.drawCpuData ), f );
@ -152,6 +155,7 @@ void UserData::SaveState( const ViewData& data )
fwrite( &data.dynamicColors, 1, sizeof( data.dynamicColors ), f );
fwrite( &data.forceColors, 1, sizeof( data.forceColors ), f );
fwrite( &data.ghostZones, 1, sizeof( data.ghostZones ), f );
fwrite( &data.frameTarget, 1, sizeof( data.frameTarget ), f );
fclose( f );
}
}

View File

@ -8335,6 +8335,18 @@ void View::DrawOptions()
bool val = m_vd.drawEmptyLabels;
ImGui::Checkbox( ICON_FA_EXPAND " Draw empty labels", &val );
m_vd.drawEmptyLabels = val;
val = m_vd.drawFrameTargets;
ImGui::Checkbox( ICON_FA_FLAG_CHECKERED " Draw frame targets", &val );
m_vd.drawFrameTargets = val;
ImGui::Indent();
int tmp = m_vd.frameTarget;
ImGui::SetNextItemWidth( 120 );
if( ImGui::InputInt( "Target FPS", &tmp ) )
{
if( tmp < 1 ) tmp = 1;
m_vd.frameTarget = tmp;
}
ImGui::Unindent();
if( m_worker.HasContextSwitches() )
{
ImGui::Separator();

View File

@ -46,6 +46,7 @@ struct ViewData
uint8_t drawPlots = true;
uint8_t onlyContendedLocks = true;
uint8_t drawEmptyLabels = false;
uint8_t drawFrameTargets = false;
uint8_t drawContextSwitches = true;
uint8_t darkenContextSwitches = true;
uint8_t drawCpuData = true;
@ -54,6 +55,8 @@ struct ViewData
uint8_t dynamicColors = 1;
uint8_t forceColors = false;
uint8_t ghostZones = true;
uint32_t frameTarget = 60;
};
struct Annotation