Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
uyegy
CPUnetPLOT
Commits
22a5f447
Commit
22a5f447
authored
Aug 20, 2014
by
Mario Hock
Browse files
simple_plotter: print general header (to terminal)
parent
6fd3e3df
Changes
2
Hide whitespace changes
Inline
Side-by-side
cnl_library.py
View file @
22a5f447
...
...
@@ -42,6 +42,9 @@ def calc_ema(values, alpha=0.2):
def
pretty_json
(
data
):
return
json
.
dumps
(
data
,
sort_keys
=
True
,
indent
=
4
)
## Helper functions for CNLParser -- but they could also be handy in other contexts.
...
...
simple_plotter.py
View file @
22a5f447
...
...
@@ -4,7 +4,7 @@
import
sys
import
matplotlib
from
cnl_library
import
CNLParser
,
calc_ema
,
merge_lists
from
cnl_library
import
CNLParser
,
calc_ema
,
merge_lists
,
pretty_json
## matplotlib.use('QT4Agg') # override matplotlibrc
import
matplotlib.pyplot
as
plt
...
...
@@ -27,15 +27,6 @@ def parse_cnl_file(filename):
## * Parse input file. *
cnl_file
=
CNLParser
(
filename
)
## Display header informations.
print
(
cnl_file
.
get_type
()
)
print
(
cnl_file
.
get_comment
()
)
print
(
"CPUs: "
+
str
(
cnl_file
.
get_cpus
())
)
print
(
"NICs: "
+
str
(
cnl_file
.
get_nics
())
)
## Prepare data for matplotlib
#nics = cnl_file.get_nics()
...
...
@@ -116,9 +107,12 @@ if __name__ == "__main__":
for
i
in
range
(
1
,
num_files
+
1
):
## Read file
filename
=
sys
.
argv
[
i
]
print
(
filename
)
cnl_file
=
parse_cnl_file
(
filename
)
print
(
filename
)
print
(
pretty_json
(
cnl_file
.
get_general_header
())
)
print
()
## Plot with matplotlib.
## Draw comment on the figure (use absolute positioning).
...
...
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