Skip to content

Commit

Permalink
Merge pull request #459 from theobisproject/fix-amd-gpu-memory
Browse files Browse the repository at this point in the history
Fix wrong unit of amd gpu memory reading
  • Loading branch information
corecoding authored Jan 17, 2025
2 parents f0ba501 + 577f85e commit af9b160
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ export const Sensors = GObject.registerClass({

_readGpuDrm(callback){
const multiGpu = this._gpu_drm_indices.length > 1;
const unit = this._settings.get_int('memory-measurement') ? 1000 : 1024;
for (let z = 0; z < this._gpu_drm_indices.length; z++ ) {
let i = this._gpu_drm_indices[z];
const typeName = 'gpu#' + i;
Expand All @@ -655,12 +656,12 @@ export const Sensors = GObject.registerClass({
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_used').read().then(value => {
this._returnGpuValue(callback, 'Memory Used', parseInt(value), typeName, 'memory');
this._returnGpuValue(callback, 'Memory Used', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_total').read().then(value => {
this._returnGpuValue(callback, 'Memory Total', parseInt(value), typeName, 'memory');
this._returnGpuValue(callback, 'Memory Total', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
Expand Down

0 comments on commit af9b160

Please sign in to comment.