diff --git a/src/processor/processorHeader.ts b/src/processor/processorHeader.ts index 41f5c4b..d063044 100644 --- a/src/processor/processorHeader.ts +++ b/src/processor/processorHeader.ts @@ -416,15 +416,15 @@ export default GObject.registerClass( if(this.frequencyMode === 'average') { const sum = frequency.reduce((a, b) => a + b, 0); this.frequency.text = Utils.formatFrequency( - sum / frequency.length / 1000, - 'MHz', + sum / frequency.length / 1000, /** Convert to GHz */ + 'GHz', figures, true ); } else if(this.frequencyMode === 'max') { this.frequency.text = Utils.formatFrequency( - Math.max(...frequency) / 1000, - 'MHz', + Math.max(...frequency) / 1000, /** Convert to GHz */ + 'GHz', figures, true ); diff --git a/src/processor/processorMonitor.ts b/src/processor/processorMonitor.ts index 5e3bcde..f3ee6e4 100644 --- a/src/processor/processorMonitor.ts +++ b/src/processor/processorMonitor.ts @@ -777,6 +777,14 @@ export default class ProcessorMonitor extends Monitor { }; } + /** + * Reading frequency from /sys/devices/system/cpu/cpu/cpufreq/scaling_cur_freq + * This read frequency in KHz. This function read the frequency and converts it in MHz + * by dividing it with 1000. + * + * source: https://www.kernel.org/doc/Documentation/cpu-freq/user-guide.txt#:~:text=scaling_cur_freq%20%3A%20Current%20frequency%20of%20the,and%20cpufreq%20core%2C%20in%20KHz. + * + */ async updateCpuCoresFrequencyProc(): Promise { if(this.isListeningFor('cpuCoresFrequency')) { try { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 68668fa..0173e15 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1712,7 +1712,7 @@ export default class Utils { return id; } } - if(disks.size > 0) return disks.keys().next().value; + if(disks.size > 0) return disks.keys().next().value || null; return null; }