summaryrefslogtreecommitdiffstats
path: root/superkaramba/src/karamba.cpp
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-09-30 23:58:12 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-10-02 21:36:51 +0300
commit8bd95de8fd69a486948c46dfd436a38383876b04 (patch)
tree26d78a1bfd0ca422becdb1f57b0f38c0bc6c77e9 /superkaramba/src/karamba.cpp
parent2c4a3e7f855038e1e66022aad41462793ac79215 (diff)
downloadtdeutils-6346fa583706844434bf00711e12d33615dec1ed.tar.gz
tdeutils-6346fa583706844434bf00711e12d33615dec1ed.zip
Superkaramba: add GPU load sensorr14.1.3
The sensor has a required `driver` parameter and an optional `gpu` parameter. - The former specifies the backend to use to query the system about GPU load. - The latter specifies the id of the GPU to check. If left out, the backend default will be used. For now it only supports NVidia GPUs via the `nvidia` driver, but it can be extended. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit 480f195dde7ef1fd9fd81ce0ea18924d81a4eda9)
Diffstat (limited to 'superkaramba/src/karamba.cpp')
-rw-r--r--superkaramba/src/karamba.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/superkaramba/src/karamba.cpp b/superkaramba/src/karamba.cpp
index d4a74f7..d828411 100644
--- a/superkaramba/src/karamba.cpp
+++ b/superkaramba/src/karamba.cpp
@@ -988,6 +988,26 @@ void karamba::setSensor(const LineParser& lineParser, Meter* meter)
}
+ if (sens == "GPU")
+ {
+ TQString gpuId = lineParser.getString("GPU");
+ TQString gpuDriver = lineParser.getString("DRIVER");
+ TQString sensorId = TQString("GPU_%1_%2").arg(gpuDriver, gpuId);
+ sensor = sensorMap[sensorId];
+ if (sensor == 0)
+ {
+ int interval = lineParser.getInt("INTERVAL");
+ interval = (interval == 0) ? 1000 : interval;
+ sensor = (sensorMap[sensorId] = new GPUSensor(gpuDriver, gpuId, interval));
+ sensorList->append(sensor);
+ }
+
+ SensorParams *sp = new SensorParams(meter);
+ sp->addParam("FORMAT", m_theme.locale()->translate(lineParser.getString("FORMAT").ascii()));
+ sensor->addMeter(sp);
+ sensor->setMaxValue(sp);
+ }
+
if( sens == "MEMORY" )
{
sensor = sensorMap["MEMORY"];