diff --git a/amdpstateeditor.cpp b/amdpstateeditor.cpp index e64f839..806c527 100644 --- a/amdpstateeditor.cpp +++ b/amdpstateeditor.cpp @@ -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; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 87937ab..7129efd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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; iunderMouse()) { 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; isetText(QString::number(GPU[currentGPUIndex].data[plotIndex].vector[index])); +} void MainWindow::clearPlots() { for (int i=0; ireplot(); plotCmdsList[i].plot->update(); } - mouseOverPlot = false; + insidePlot = false; } void MainWindow::clearExtremeValues() { diff --git a/mainwindow.h b/mainwindow.h index 9a75d31..46b9e37 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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 qv_time; + // For updating the plot + bool insidePlot = false; + double latestPointerXcoord; + int plotIndex = 0; struct plotCmds {