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
e0d5f0cf
Commit
e0d5f0cf
authored
Aug 15, 2014
by
Mario Hock
Browse files
Store whole sysinfo instead of just the hostname
parent
8614f529
Changes
3
Show whitespace changes
Inline
Side-by-side
__init__.py
View file @
e0d5f0cf
...
...
@@ -228,20 +228,13 @@ if __name__ == "__main__":
else
:
environment
=
None
## Get hostname (for display and logging).
osdetails
=
tuple
(
os
.
uname
())
ostype
=
osdetails
[
0
]
hostname
=
osdetails
[
1
]
## --autologging implies --logging
if
(
args
.
autologging
):
args
.
logging
=
True
## Logging
logging_manager
=
LoggingManager
(
psutil
.
NUM_CPUS
,
monitored_nics
,
h
ostname
,
environment
,
logging_manager
=
LoggingManager
(
psutil
.
NUM_CPUS
,
monitored_nics
,
h
elpers
.
get_sysinfo
()
,
environment
,
args
.
comment
,
args
.
path
,
args
.
autologging
,
args
.
watch
)
if
args
.
logging
:
logging_manager
.
enable_measurement_logger
()
...
...
helpers.py
View file @
e0d5f0cf
...
...
@@ -163,3 +163,16 @@ def split_proprtionally(text, weights, size=0, fill=" "):
last_pos
+=
pos
return
ret
def
get_sysinfo
():
#uname = os.uname()
#input_fields = ("sysname", "nodename", "release", "version", "machine")
output_fields
=
(
"sysname"
,
"hostname"
,
"kernel"
,
"version"
,
"machine"
)
ret
=
dict
()
for
out_field
,
value
in
zip
(
output_fields
,
os
.
uname
()):
ret
[
out_field
]
=
value
return
ret
logging.py
View file @
e0d5f0cf
...
...
@@ -26,7 +26,7 @@ class MeasurementLogger:
## Initialization ##
def
__init__
(
self
,
num_cpus
,
nics
,
begin
,
hostname
,
environment
,
comment
,
filename
):
def
__init__
(
self
,
num_cpus
,
nics
,
begin
,
system_info
,
environment
,
comment
,
filename
):
## Attributes
self
.
num_cpus
=
num_cpus
self
.
nics
=
nics
...
...
@@ -43,7 +43,7 @@ class MeasurementLogger:
self
.
class_defs
.
values
(),
self
.
type_string
,
begin
,
hostname
,
system_info
,
environment
,
comment
)
...
...
@@ -94,7 +94,7 @@ class MeasurementLogger:
## TODO Move this outside the class?
def
_create_json_header
(
self
,
class_names
,
class_defs
,
type
,
begin
,
hostname
,
environment
,
comment
):
def
_create_json_header
(
self
,
class_names
,
class_defs
,
type
,
begin
,
system_info
,
environment
,
comment
):
top_level
=
dict
()
general
=
dict
()
class_definitions
=
dict
()
...
...
@@ -104,7 +104,7 @@ class MeasurementLogger:
general
[
"Type"
]
=
type
general
[
"Comment"
]
=
comment
general
[
"Date"
]
=
begin
general
[
"
Hostname"
]
=
hostname
general
[
"
SystemInfo"
]
=
system_info
general
[
"Environment"
]
=
environment
#general["End"] = 0 ## TODO ... can't be written at the beginning of the file!!
#general["Duration"] = 0 ## TODO
...
...
@@ -252,13 +252,14 @@ class CNLFileWriter:
class
LoggingManager
:
def
__init__
(
self
,
num_cpus
,
nics
,
hostname
,
environment
,
comment
,
path
,
autologging
,
watch_experiment
):
def
__init__
(
self
,
num_cpus
,
nics
,
system_info
,
environment
,
comment
,
path
,
autologging
,
watch_experiment
):
self
.
num_cpus
=
num_cpus
self
.
nics
=
nics
self
.
comment
=
comment
self
.
auto_comment
=
None
self
.
path
=
path
self
.
hostname
=
hostname
self
.
system_info
=
system_info
self
.
hostname
=
system_info
[
"hostname"
]
self
.
environment
=
environment
self
.
watch_experiment
=
watch_experiment
...
...
@@ -312,7 +313,7 @@ class LoggingManager:
# Create Logger.
self
.
measurement_logger
=
MeasurementLogger
(
self
.
num_cpus
,
self
.
nics
,
[
date
,
t
],
self
.
hostname
,
self
.
environment
,
self
.
system_info
,
self
.
environment
,
self
.
auto_comment
if
self
.
auto_comment
else
self
.
comment
,
filename
)
...
...
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