try to fix pstate applying

This commit is contained in:
jussi 2019-02-22 17:22:45 +02:00
parent 8a3f883029
commit cdc372f2e9
3 changed files with 31 additions and 8 deletions

View File

@ -129,7 +129,7 @@ bool amdPstateEditor::applyValues()
if ((corePstates[i].freqspinbox->value() != types->GPUList[0].coreclocks[i]) || (corePstates[i].voltspinbox->value() != types->GPUList[0].corevolts[i])) {
volt = QString::number(corePstates[i].freqspinbox->value());
freq = QString::number(corePstates[i].voltspinbox->value());
proc.start("/bin/sh -c \"pkexec echo \"s "+ volt +" "+ freq +"\" "+"> /sys/class/drm/card"+QString::number(types->GPUList[0].fsindex)+"/device/pp_od_clk_voltage\"");
proc.start("/bin/sh -c \"pkexec echo \"s "+ QString::number(i) + " "+ volt +" "+ freq +"\" "+"> /sys/class/drm/card"+QString::number(types->GPUList[0].fsindex)+"/device/pp_od_clk_voltage\"");
proc.waitForFinished();
}
}
@ -138,9 +138,14 @@ bool amdPstateEditor::applyValues()
if ((corePstates[i].freqspinbox->value() != types->GPUList[0].coreclocks[i]) || (corePstates[i].voltspinbox->value() != types->GPUList[0].corevolts[i])) {
volt = QString::number(corePstates[i].freqspinbox->value());
freq = QString::number(corePstates[i].voltspinbox->value());
proc.start("/bin/sh -c \"pkexec echo \"s "+ volt +" "+ freq +"\" "+"> /sys/class/drm/card"+QString::number(types->GPUList[0].fsindex)+"/device/pp_od_clk_voltage\"");
proc.start("/bin/sh -c \"pkexec echo \"m "+ QString::number(i) + " "+ volt +" "+ freq +"\" "+"> /sys/class/drm/card"+QString::number(types->GPUList[0].fsindex)+"/device/pp_od_clk_voltage\"");
proc.waitForFinished();
}
}
QString cmd = "/bin/sh -c \"pkexec echo pootis > /home/jussi/Documents/testfile\"";
qDebug() << cmd;
proc.start(cmd);
proc.waitForFinished();
return true;
}

View File

@ -537,20 +537,22 @@ void MainWindow::updateMonitor()
counter = 0;
}
counter++;
//if (mouseOverPlot) plotHovered(event)
if (insidePlot) updateTracer();
}
void MainWindow::plotHovered(QMouseEvent *event)
{
QPoint cursor = event->pos();
int plotIndex = 0;
plotIndex = 0;
for (int i=0; i<plotCmdsList.size(); i++) {
if (plotCmdsList[i].widget->underMouse()) {
plotIndex = i;
break;
}
}
mouseOverPlot = true;
insidePlot = true;
double pointerxcoord = plotCmdsList[plotIndex].plot->xAxis->pixelToCoord(cursor.x());
latestPointerXcoord = pointerxcoord;
plotCmdsList[plotIndex].tracer->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper);
// Find the y-value for the corresponding coordinate
int valIndex = 0;
@ -575,11 +577,23 @@ void MainWindow::plotHovered(QMouseEvent *event)
} else {
// If the cursor is not within the x-range, clear the text
plotCmdsList[plotIndex].valText->setText("");
mouseOverPlot = false;
insidePlot = false;
}
plotCmdsList[plotIndex].plot->update();
plotCmdsList[plotIndex].plot->replot();
}
void MainWindow::updateTracer()
{
int index = 0;
double delta = abs(latestPointerXcoord - GPU[currentGPUIndex].qv_time[0]);
for (int i=0; i<GPU[currentGPUIndex].qv_time.size(); i++) {
if (abs(latestPointerXcoord - GPU[currentGPUIndex].qv_time[i]) < delta) {
delta = abs(latestPointerXcoord - GPU[currentGPUIndex].qv_time[i]);
index = i;
}
}
plotCmdsList[plotIndex].valText->setText(QString::number(GPU[currentGPUIndex].data[plotIndex].vector[index]));
}
void MainWindow::clearPlots()
{
for (int i=0; i<plotCmdsList.size(); i++) {
@ -588,7 +602,7 @@ void MainWindow::clearPlots()
plotCmdsList[i].plot->replot();
plotCmdsList[i].plot->update();
}
mouseOverPlot = false;
insidePlot = false;
}
void MainWindow::clearExtremeValues()
{

View File

@ -148,6 +148,7 @@ private slots:
void tabHandler(int index);
void setupGraphMonitorTab();
void plotHovered(QMouseEvent *event);
void updateTracer();
void clearPlots();
void clearExtremeValues();
void on_actionManage_profiles_triggered();
@ -160,7 +161,6 @@ private slots:
private:
Ui::MainWindow *ui;
bool noProfiles = true;
bool mouseOverPlot = false;
QStringList UUIDList;
QString latestUUID;
#ifdef NVIDIA
@ -208,6 +208,10 @@ private:
QCustomPlot *fanSpeedPlot = new QCustomPlot(this);
//QVector <double> qv_time;
// For updating the plot
bool insidePlot = false;
double latestPointerXcoord;
int plotIndex = 0;
struct plotCmds
{