Added scheduler config parameters to Qt GUI.

This commit is contained in:
Matthew Budd 2020-11-28 00:28:28 -05:00
parent ab31c760d5
commit e67b17795c
4 changed files with 51 additions and 2 deletions

View File

@ -1878,9 +1878,12 @@ int consoleWin_t::getSchedParam( int &policy, int &priority )
if ( sched_getparam( getpid(), &p ) )
{
ret = -1;
priority = 0;
}
else
{
priority = p.sched_priority;
}
priority = p.sched_priority;
#elif defined(__APPLE__)
struct sched_param p;

View File

@ -22,6 +22,7 @@
TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
: QDialog( parent )
{
int opt;
QVBoxLayout *mainLayout, *vbox;
//QHBoxLayout *hbox;
QGridLayout *grid;
@ -80,6 +81,10 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
setLayout( mainLayout );
g_config->getOption( "SDL.SetSchedParam", &opt );
emuPrioCtlEna->setChecked( opt );
updatePolicyBox();
updateSliderLimits();
updateSliderValues();
@ -90,6 +95,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
connect( guiSchedPolicyBox , SIGNAL(activated(int)) , this, SLOT(guiSchedPolicyChange(int)) );
connect( guiSchedNiceSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedNiceChange(int)) );
connect( guiSchedPrioSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedPrioChange(int)) );
connect( emuPrioCtlEna , SIGNAL(stateChanged(int)), this, SLOT(emuSchedCtlChange(int)) );
}
//----------------------------------------------------------------------------
TimingConfDialog_t::~TimingConfDialog_t(void)
@ -103,6 +109,7 @@ void TimingConfDialog_t::closeEvent(QCloseEvent *event)
done(0);
deleteLater();
event->accept();
saveValues();
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::closeWindow(void)
@ -110,6 +117,35 @@ void TimingConfDialog_t::closeWindow(void)
//printf("Close Window\n");
done(0);
deleteLater();
saveValues();
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::emuSchedCtlChange( int state )
{
g_config->setOption( "SDL.SetSchedParam", (state != Qt::Unchecked) );
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::saveValues(void)
{
int policy, prio;
if ( consoleWindow == NULL )
{
return;
}
consoleWindow->emulatorThread->getSchedParam( policy, prio );
g_config->setOption( "SDL.EmuSchedPolicy", policy );
g_config->setOption( "SDL.EmuSchedPrioRt", prio );
g_config->setOption( "SDL.EmuSchedNice" , consoleWindow->emulatorThread->getNicePriority() );
consoleWindow->getSchedParam( policy, prio );
g_config->setOption( "SDL.GuiSchedPolicy", policy );
g_config->setOption( "SDL.GuiSchedPrioRt", prio );
g_config->setOption( "SDL.GuiSchedNice" , consoleWindow->getNicePriority() );
g_config->save();
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::emuSchedNiceChange(int val)

View File

@ -44,10 +44,12 @@ class TimingConfDialog_t : public QDialog
void updatePolicyBox(void);
void updateSliderLimits(void);
void updateSliderValues(void);
void saveValues(void);
public slots:
void closeWindow(void);
private slots:
void emuSchedCtlChange( int state );
void emuSchedNiceChange( int val );
void emuSchedPrioChange( int val );
void emuSchedPolicyChange( int index );

View File

@ -315,6 +315,14 @@ InitConfig()
config->addOption("_useNativeFileDialog", "SDL.UseNativeFileDialog", false);
config->addOption("_useNativeMenuBar" , "SDL.UseNativeMenuBar", false);
config->addOption("_setSchedParam" , "SDL.SetSchedParam" , 0);
config->addOption("_emuSchedPolicy" , "SDL.EmuSchedPolicy", 0);
config->addOption("_emuSchedNice" , "SDL.EmuSchedNice ", 0);
config->addOption("_emuSchedPrioRt" , "SDL.EmuSchedPrioRt", 40);
config->addOption("_guiSchedPolicy" , "SDL.GuiSchedPolicy", 0);
config->addOption("_guiSchedNice" , "SDL.GuiSchedNice ", 0);
config->addOption("_guiSchedPrioRt" , "SDL.GuiSchedPrioRt", 40);
// fcm -> fm2 conversion
config->addOption("fcmconvert", "SDL.FCMConvert", "");