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
7e218890
Commit
7e218890
authored
Jul 17, 2014
by
Mario Hock
Browse files
some docu
parent
973f7b17
Changes
1
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
7e218890
...
...
@@ -24,7 +24,8 @@ MEASUREMENT_INTERVAL = 0.2
class
Reading
:
## ***
""" A single reading of various CPU, NET, ... values. --> Building block for the »Measurement« class."""
def
__init__
(
self
):
## * measurements *
self
.
timestamp
=
get_time
()
...
...
@@ -45,6 +46,8 @@ class Reading:
class
NetworkTraffic
:
""" Utility class for calculating and storing network traffic: Total amount (during a timespan) and ratio. """
def
__init__
(
self
,
older_counters
,
younger_counters
,
timespan
):
self
.
total
=
dict
()
self
.
ratio
=
dict
()
...
...
@@ -61,6 +64,8 @@ class NetworkTraffic:
class
Measurement
:
""" Calculates and stores CPU utilization, network traffic, ... during a timespan. Based two »Readings«. """
def
__init__
(
self
,
reading1
,
reading2
):
self
.
r1
=
reading1
self
.
r2
=
reading2
...
...
@@ -82,6 +87,8 @@ class Measurement:
def
measure
(
interval
=
MEASUREMENT_INTERVAL
):
""" Convenience function to perform one »Measurement« """
r1
=
Reading
()
time
.
sleep
(
interval
)
r2
=
Reading
()
...
...
@@ -132,6 +139,8 @@ def displayX(measurement):
print
## XXX TESTING
def
test_loop
():
for
i
in
range
(
10
):
...
...
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