system-monitor-graph@rcassani: Remove unsafe calls and desklet warning (#914)
Attempts to resolve #913
This commit is contained in:
parent
b2910cee12
commit
16defd7701
@ -1,9 +1,9 @@
|
||||
const ByteArray = imports.byteArray;
|
||||
const Desklet = imports.ui.desklet;
|
||||
const Settings = imports.ui.settings;
|
||||
const Mainloop = imports.mainloop;
|
||||
const Lang = imports.lang;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Cinnamon = imports.gi.Cinnamon;
|
||||
const Gio = imports.gi.Gio;
|
||||
const Cairo = imports.cairo;
|
||||
const St = imports.gi.St;
|
||||
@ -474,9 +474,11 @@ SystemMonitorGraph.prototype = {
|
||||
|
||||
get_hdd_use: function(fs) {
|
||||
// https://stackoverflow.com/questions/4458183/how-the-util-of-iostat-is-computed
|
||||
let cpu_line = Cinnamon.get_file_contents_utf8_sync("/proc/stat").match(/cpu\s.+/)[0];
|
||||
let cpu_obj = GLib.file_get_contents("/proc/stat")[1];
|
||||
let cpu_line = ByteArray.toString(cpu_obj).match(/cpu\s.+/)[0];
|
||||
let re = new RegExp(fs + '.+');
|
||||
let hdd_line = Cinnamon.get_file_contents_utf8_sync("/proc/diskstats").match(re)[0];
|
||||
let diskstats = GLib.file_get_contents("/proc/diskstats")[1];
|
||||
let hdd_line = ByteArray.toString(diskstats).match(re)[0];
|
||||
// get total CPU time
|
||||
let cpu_values = cpu_line.split(/\s+/);
|
||||
let hdd_cpu_tot = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user