-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocstats.py
35 lines (29 loc) · 900 Bytes
/
procstats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
with open('/proc/cpuinfo') as f:
for line in f:
if (line.find("model name") != -1):
print(line.rstrip('\n'))
break
with open('/proc/cpuinfo') as f:
for line in f:
if (line.find("cpu cores") != -1):
print(line.rstrip('\n'))
break
with open('/proc/cpuinfo') as f:
for line in f:
if (line.find("cpu MHz") != -1):
print(line.rstrip('\n'))
break
with open('/proc/meminfo') as f:
for line in f:
if (line.find("MemTotal:") != -1):
print(line.rstrip('\n'))
break
with open('/proc/meminfo') as f:
for line in f:
if (line.find("MemFree:") != -1):
print(line.rstrip('\n'))
break
with open('/proc/version') as f:
for line in f:
print(line.rstrip('\n'))
break