mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-24 17:20:17 -06:00
crash fix
This commit is contained in:
parent
ca4dc4cc33
commit
58544d6e51
@ -407,18 +407,18 @@ void MainWindow::updateMonitor()
|
|||||||
memusage->setText(1, QString::number(nv->GPUList[currentGPUIndex].usedVRAM) + "/" + QString::number(nv->GPUList[currentGPUIndex].totalVRAM) + "MB");
|
memusage->setText(1, QString::number(nv->GPUList[currentGPUIndex].usedVRAM) + "/" + QString::number(nv->GPUList[currentGPUIndex].totalVRAM) + "MB");
|
||||||
|
|
||||||
// Decrement all time values by one
|
// Decrement all time values by one
|
||||||
for (int i=0; i<nv->GPUList[currentGPUIndex].qv_time.length(); i++) {
|
for (int i=0; i<GPU[currentGPUIndex].qv_time.length(); i++) {
|
||||||
nv->GPUList[currentGPUIndex].qv_time[i]--;
|
GPU[currentGPUIndex].qv_time[i]--;
|
||||||
}
|
}
|
||||||
// Add current time (0)
|
// Add current time (0)
|
||||||
if (nv->GPUList[currentGPUIndex].qv_time.size() < plotVectorSize) {
|
if (GPU[currentGPUIndex].qv_time.size() < plotVectorSize) {
|
||||||
nv->GPUList[currentGPUIndex].qv_time.append(0);
|
GPU[currentGPUIndex].qv_time.append(0);
|
||||||
} else {
|
} else {
|
||||||
nv->GPUList[currentGPUIndex].qv_time.insert(plotVectorSize, 0);
|
GPU[currentGPUIndex].qv_time.insert(plotVectorSize, 0);
|
||||||
}
|
}
|
||||||
// Remove the first elements if there are more elements than the x-range
|
// Remove the first elements if there are more elements than the x-range
|
||||||
if (nv->GPUList[currentGPUIndex].qv_time.size() > plotVectorSize) {
|
if (GPU[currentGPUIndex].qv_time.size() > plotVectorSize) {
|
||||||
nv->GPUList[currentGPUIndex].qv_time.removeFirst();
|
GPU[currentGPUIndex].qv_time.removeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<plotCmdsList.size(); i++) {
|
for (int i=0; i<plotCmdsList.size(); i++) {
|
||||||
@ -443,7 +443,7 @@ void MainWindow::updateMonitor()
|
|||||||
if (GPU[currentGPUIndex].data[i].vector.size() > plotVectorSize) {
|
if (GPU[currentGPUIndex].data[i].vector.size() > plotVectorSize) {
|
||||||
GPU[currentGPUIndex].data[i].vector.removeFirst();
|
GPU[currentGPUIndex].data[i].vector.removeFirst();
|
||||||
}
|
}
|
||||||
plotCmdsList[i].plot->graph(0)->setData(nv->GPUList[currentGPUIndex].qv_time, GPU[currentGPUIndex].data[i].vector);
|
plotCmdsList[i].plot->graph(0)->setData(GPU[currentGPUIndex].qv_time, GPU[currentGPUIndex].data[i].vector);
|
||||||
// If the newest value is out of bounds, resize the y-range
|
// If the newest value is out of bounds, resize the y-range
|
||||||
if (plotCmdsList[i].valueq > plotCmdsList[i].plot->yAxis->range().upper) {
|
if (plotCmdsList[i].valueq > plotCmdsList[i].plot->yAxis->range().upper) {
|
||||||
plotCmdsList[i].plot->yAxis->setRangeUpper(plotCmdsList[i].valueq + plotCmdsList[i].valueq*0.1);
|
plotCmdsList[i].plot->yAxis->setRangeUpper(plotCmdsList[i].valueq + plotCmdsList[i].valueq*0.1);
|
||||||
@ -487,7 +487,6 @@ void MainWindow::updateMonitor()
|
|||||||
void MainWindow::plotHovered(QMouseEvent *event)
|
void MainWindow::plotHovered(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QPoint cursor = event->pos();
|
QPoint cursor = event->pos();
|
||||||
|
|
||||||
int plotIndex = 0;
|
int plotIndex = 0;
|
||||||
for (int i=0; i<plotCmdsList.size(); i++) {
|
for (int i=0; i<plotCmdsList.size(); i++) {
|
||||||
if (plotCmdsList[i].widget->underMouse()) {
|
if (plotCmdsList[i].widget->underMouse()) {
|
||||||
@ -499,15 +498,15 @@ void MainWindow::plotHovered(QMouseEvent *event)
|
|||||||
plotCmdsList[plotIndex].tracer->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper);
|
plotCmdsList[plotIndex].tracer->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper);
|
||||||
// Find the y-value for the corresponding coordinate
|
// Find the y-value for the corresponding coordinate
|
||||||
int valIndex = 0;
|
int valIndex = 0;
|
||||||
if (!nv->GPUList[currentGPUIndex].qv_time.isEmpty() && pointerxcoord > -plotVectorSize*1.01 && pointerxcoord <= 0 + plotVectorSize*0.01) {
|
if (!GPU[currentGPUIndex].qv_time.isEmpty() && pointerxcoord > -plotVectorSize*1.01 && pointerxcoord <= 0 + plotVectorSize*0.01) {
|
||||||
double deltax = abs(nv->GPUList[currentGPUIndex].qv_time[0] - pointerxcoord);
|
double deltax = abs(GPU[currentGPUIndex].qv_time[0] - pointerxcoord);
|
||||||
for (int i=0; i<plotCmdsList[plotIndex].vector.size(); i++) {
|
for (int i=0; i<GPU[currentGPUIndex].qv_time.size(); i++) {
|
||||||
if (abs(nv->GPUList[currentGPUIndex].qv_time[i] - pointerxcoord) < deltax) {
|
if (abs(GPU[currentGPUIndex].qv_time[i] - pointerxcoord) < deltax) {
|
||||||
deltax = abs(nv->GPUList[currentGPUIndex].qv_time[i] - pointerxcoord);
|
deltax = abs(GPU[currentGPUIndex].qv_time[i] - pointerxcoord);
|
||||||
valIndex = i;
|
valIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plotCmdsList[plotIndex].valText->setText(QString::number(plotCmdsList[plotIndex].vector[valIndex]));
|
plotCmdsList[plotIndex].valText->setText(QString::number(GPU[currentGPUIndex].data[plotIndex].vector[valIndex]));
|
||||||
// Make the text stay inside the plot
|
// Make the text stay inside the plot
|
||||||
if (pointerxcoord > -plotVectorSize*0.06) {
|
if (pointerxcoord > -plotVectorSize*0.06) {
|
||||||
plotCmdsList[plotIndex].valText->position->setCoords(-plotVectorSize*0.06, plotCmdsList[plotIndex].plot->yAxis->range().upper - plotCmdsList[plotIndex].plot->yAxis->range().size()*0.05);
|
plotCmdsList[plotIndex].valText->position->setCoords(-plotVectorSize*0.06, plotCmdsList[plotIndex].plot->yAxis->range().upper - plotCmdsList[plotIndex].plot->yAxis->range().size()*0.05);
|
||||||
|
@ -195,7 +195,7 @@ private:
|
|||||||
QCustomPlot *voltagePlot = new QCustomPlot(this);
|
QCustomPlot *voltagePlot = new QCustomPlot(this);
|
||||||
QCustomPlot *fanSpeedPlot = new QCustomPlot(this);
|
QCustomPlot *fanSpeedPlot = new QCustomPlot(this);
|
||||||
|
|
||||||
QVector <double> qv_time;
|
//QVector <double> qv_time;
|
||||||
|
|
||||||
struct plotCmds
|
struct plotCmds
|
||||||
{
|
{
|
||||||
@ -218,6 +218,7 @@ private:
|
|||||||
|
|
||||||
struct GPUData {
|
struct GPUData {
|
||||||
QVector <datavector> data;
|
QVector <datavector> data;
|
||||||
|
QVector <double> qv_time;
|
||||||
};
|
};
|
||||||
QVector <GPUData> GPU;
|
QVector <GPUData> GPU;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
3
nvidia.h
3
nvidia.h
@ -5,7 +5,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QtX11Extras/QX11Info>
|
#include <QtX11Extras/QX11Info>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
//#include "nvml.h"
|
|
||||||
#include <nvml.h>
|
#include <nvml.h>
|
||||||
|
|
||||||
class nvidia : public QObject
|
class nvidia : public QObject
|
||||||
@ -54,8 +53,6 @@ public:
|
|||||||
uint powerLim;
|
uint powerLim;
|
||||||
int totalVRAM;
|
int totalVRAM;
|
||||||
int usedVRAM;
|
int usedVRAM;
|
||||||
// Vectors for plotting
|
|
||||||
QVector <double> qv_time;
|
|
||||||
};
|
};
|
||||||
QVector <GPU> GPUList;
|
QVector <GPU> GPUList;
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ SOURCES += \
|
|||||||
qcustomplot.cpp \
|
qcustomplot.cpp \
|
||||||
editprofile.cpp \
|
editprofile.cpp \
|
||||||
newprofile.cpp \
|
newprofile.cpp \
|
||||||
monitor.cpp \
|
|
||||||
plotwidget.cpp \
|
plotwidget.cpp \
|
||||||
nvidia.cpp
|
nvidia.cpp
|
||||||
|
|
||||||
@ -41,16 +40,17 @@ HEADERS += \
|
|||||||
qcustomplot.h \
|
qcustomplot.h \
|
||||||
editprofile.h \
|
editprofile.h \
|
||||||
newprofile.h \
|
newprofile.h \
|
||||||
monitor.h \
|
|
||||||
plotwidget.h \
|
plotwidget.h \
|
||||||
nvidia.h \
|
nvidia.h \
|
||||||
|
nvml.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
editprofile.ui \
|
editprofile.ui \
|
||||||
newprofile.ui
|
newprofile.ui
|
||||||
|
|
||||||
INCLUDEPATH += $$(INCLUDEPATH) $$(LIBRARY_PATH)
|
INCLUDEPATH += "/usr/lib"
|
||||||
|
INCLUDEPATH += $$(INCLUDEPATH)
|
||||||
|
|
||||||
LIBS += -lXext -lXNVCtrl -lX11 -lnvidia-ml
|
LIBS += -lXext -lXNVCtrl -lX11 -lnvidia-ml
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
|
Loading…
Reference in New Issue
Block a user