Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CPUnetLOG
CPUnetLOG
Commits
f8206c7c
Commit
f8206c7c
authored
Jul 16, 2014
by
Mario Hock
Browse files
display CPU, RAM, NET
parent
16da5361
Changes
1
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
f8206c7c
...
...
@@ -41,11 +41,14 @@ class Measurement:
t
=
self
.
get_time
()
## * measurements *
self
.
cpu
=
psutil
.
cpu_percent
(
interval
=
0
,
percpu
=
True
)
self
.
cpu_util
=
psutil
.
cpu_percent
(
interval
=
0
,
percpu
=
True
)
self
.
cpu_times
=
psutil
.
cpu_times_percent
(
interval
=
0
,
percpu
=
True
)
self
.
memory
=
psutil
.
virtual_memory
()
self
.
net_io
=
psutil
.
net_io_counters
(
pernic
=
True
)
## timing
t2
=
time
.
time
()
assert
(
t2
-
t
<
0.
0
01
)
## XXX should be fast!!
assert
(
t2
-
t
<
0.01
)
## XXX should be fast!!
## store timespan for these statistics (if reasonable)
if
(
self
.
last_measurement
):
...
...
@@ -59,7 +62,12 @@ class Measurement:
self
.
update_last_measurement
(
t
)
def
__str__
(
self
):
return
"Timespan: "
+
str
(
self
.
timespan
)
+
"; CPU: "
+
str
(
self
.
cpu
)
## •‣∘⁕∗◘☉☀★◾☞☛⦿
return
"◘ Timespan: "
+
str
(
self
.
timespan
)
+
\
"
\n
◘ CPU utilization: "
+
str
(
self
.
cpu_util
)
+
\
"
\n
◘ CPU times: "
+
str
(
self
.
cpu_times
)
+
\
"
\n
◘ RAM: "
+
str
(
self
.
memory
)
+
\
"
\n
◘ NET: "
+
str
(
self
.
net_io
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment