get_cpu_usage workaround for Mac
This commit is contained in:
parent
09f81ab1e7
commit
30e6dd97fa
@ -617,7 +617,10 @@ last_idletime=0
|
|||||||
|
|
||||||
def get_cpu_usage():
|
def get_cpu_usage():
|
||||||
global last_worktime, last_idletime
|
global last_worktime, last_idletime
|
||||||
|
try:
|
||||||
f=open("/proc/stat","r")
|
f=open("/proc/stat","r")
|
||||||
|
except:
|
||||||
|
return 0 #Workaround, possibly we're on a Mac
|
||||||
line=""
|
line=""
|
||||||
while not "cpu " in line: line=f.readline()
|
while not "cpu " in line: line=f.readline()
|
||||||
f.close()
|
f.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user