Get info from terminal
-
Hello!
I want to get the results temp from "nvidia-settings -q gpucoretemp"
~ $ nvidia-settings -q gpucoretempAttribute 'GPUCoreTemp' (Z68X-UD3P-B3:0.0): 46.
'GPUCoreTemp' is an integer attribute.
'GPUCoreTemp' is a read-only attribute.
'GPUCoreTemp' can use the following target types: X Screen, GPU.
So what i need is to take the temp (it is 46 right now) and make the program update at every sec
can someone help me? -
Hi,
Shouldn't you rather use the nvidia management library for that task ?
-
Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!
-
@BillGR17 If you're really stuck (although it's really not that complicated), I can give you the basic 3-4 lines of code but I believe it's always better to figure things out yourself instead of just copy-pasting code.
-
@BillGR17 Have you even visited the links I gave you? Anyway here are the basic instructions
QProcess nvidia; nvidia.start("nvidia-settings", QStringList()<< "-q" << "gpucoretemp"); nvidia.waitForFinished(); QByteArray output = nvidia.readLine(); int temp = QString(ouput).split(":").last().toInt();
You might have to tweak the code a bit, I just put that together I don't know that it will compile but I don't see why it wouldn't.