Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
95108806
Commit
95108806
authored
Oct 14, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checking pep8
parent
e579d5d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
28 deletions
+26
-28
ci-scripts/stats_monitor_dev.py
ci-scripts/stats_monitor_dev.py
+26
-28
No files found.
ci-scripts/stats_monitor_dev.py
View file @
95108806
"""
To create graphs and pickle from runtime statistics in L1,MAC,RRC,PDCP files
"""
import
subprocess
import
subprocess
import
time
import
time
import
shlex
import
shlex
import
re
import
re
import
sys
import
sys
import
matplotlib.pyplot
as
plt
import
pickle
import
pickle
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
numpy
as
np
import
os
import
yaml
import
yaml
class
Stat
_
Monitor
():
class
StatMonitor
():
def
__init__
(
self
,):
def
__init__
(
self
,):
with
open
(
'stats_monitor_conf.yaml'
,
'r'
)
as
f
:
with
open
(
'stats_monitor_conf.yaml'
,
'r'
)
as
f
ile
:
self
.
d
=
yaml
.
load
(
f
)
self
.
d
=
yaml
.
load
(
f
ile
)
for
node
in
self
.
d
:
for
node
in
self
.
d
:
for
metric
in
self
.
d
[
node
]:
for
metric
in
self
.
d
[
node
]:
self
.
d
[
node
][
metric
]
=
[]
self
.
d
[
node
][
metric
]
=
[]
def
process_enb
(
self
,
node_type
,
output
):
def
process_enb
(
self
,
node_type
,
output
):
for
l
in
output
:
for
l
ine
in
output
:
tmp
=
l
.
decode
(
"utf-8"
)
tmp
=
l
ine
.
decode
(
"utf-8"
)
result
=
re
.
match
(
r
f
'^.*\bPHR\b ([0-9]+).+\bbler\b ([0-9]+\.[0-9]+).+\bmcsoff\b ([0-9]+).+\bmcs\b ([0-9]+)'
,
tmp
)
result
=
re
.
match
(
r'^.*\bPHR\b ([0-9]+).+\bbler\b ([0-9]+\.[0-9]+).+\bmcsoff\b ([0-9]+).+\bmcs\b ([0-9]+)'
,
tmp
)
if
result
is
not
None
:
if
result
is
not
None
:
self
.
d
[
node_type
][
'PHR'
].
append
(
int
(
result
.
group
(
1
)))
self
.
d
[
node_type
][
'PHR'
].
append
(
int
(
result
.
group
(
1
)))
self
.
d
[
node_type
][
'bler'
].
append
(
float
(
result
.
group
(
2
)))
self
.
d
[
node_type
][
'bler'
].
append
(
float
(
result
.
group
(
2
)))
...
@@ -32,9 +35,9 @@ class Stat_Monitor():
...
@@ -32,9 +35,9 @@ class Stat_Monitor():
def
process_gnb
(
self
,
node_type
,
output
):
def
process_gnb
(
self
,
node_type
,
output
):
for
l
in
output
:
for
l
ine
in
output
:
tmp
=
l
.
decode
(
"utf-8"
)
tmp
=
l
ine
.
decode
(
"utf-8"
)
result
=
re
.
match
(
r
f
'^.*\bPHR\b ([0-9]+).+\bbler\b ([0-9]+\.[0-9]+).+\bmcsoff\b ([0-9]+).+\bmcs\b ([0-9]+)'
,
tmp
)
result
=
re
.
match
(
r'^.*\bPHR\b ([0-9]+).+\bbler\b ([0-9]+\.[0-9]+).+\bmcsoff\b ([0-9]+).+\bmcs\b ([0-9]+)'
,
tmp
)
if
result
is
not
None
:
if
result
is
not
None
:
self
.
d
[
node_type
][
'PHR'
].
append
(
int
(
result
.
group
(
1
)))
self
.
d
[
node_type
][
'PHR'
].
append
(
int
(
result
.
group
(
1
)))
self
.
d
[
node_type
][
'bler'
].
append
(
float
(
result
.
group
(
2
)))
self
.
d
[
node_type
][
'bler'
].
append
(
float
(
result
.
group
(
2
)))
...
@@ -42,9 +45,6 @@ class Stat_Monitor():
...
@@ -42,9 +45,6 @@ class Stat_Monitor():
self
.
d
[
node_type
][
'mcs'
].
append
(
int
(
result
.
group
(
4
)))
self
.
d
[
node_type
][
'mcs'
].
append
(
int
(
result
.
group
(
4
)))
def
collect
(
self
,
node_type
):
def
collect
(
self
,
node_type
):
if
node_type
==
'enb'
:
if
node_type
==
'enb'
:
cmd
=
'cat L1_stats.log MAC_stats.log PDCP_stats.log RRC_stats.log'
cmd
=
'cat L1_stats.log MAC_stats.log PDCP_stats.log RRC_stats.log'
...
@@ -57,8 +57,8 @@ class Stat_Monitor():
...
@@ -57,8 +57,8 @@ class Stat_Monitor():
else
:
#'gnb'
else
:
#'gnb'
self
.
process_gnb
(
node_type
,
output
)
self
.
process_gnb
(
node_type
,
output
)
def
graph
(
self
,
node_type
):
def
graph
(
self
,
node_type
):
col
=
1
col
=
1
figure
,
axis
=
plt
.
subplots
(
len
(
self
.
d
[
node_type
]),
col
,
figsize
=
(
10
,
10
))
figure
,
axis
=
plt
.
subplots
(
len
(
self
.
d
[
node_type
]),
col
,
figsize
=
(
10
,
10
))
i
=
0
i
=
0
...
@@ -80,21 +80,19 @@ class Stat_Monitor():
...
@@ -80,21 +80,19 @@ class Stat_Monitor():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
node
_type
=
sys
.
argv
[
1
]
#enb or gnb
node
=
sys
.
argv
[
1
]
#enb or gnb
mon
=
Stat
_
Monitor
()
mon
=
StatMonitor
()
#collecting stats when modem process is stopped
#collecting stats when modem process is stopped
cmd
=
'ps aux | grep mode | grep -v grep'
CMD
=
'ps aux | grep mode | grep -v grep'
process
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
process
=
subprocess
.
Popen
(
CMD
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
output
=
process
.
stdout
.
readlines
()
output
=
process
.
stdout
.
readlines
()
while
len
(
output
)
!=
0
:
while
len
(
output
)
!=
0
:
mon
.
collect
(
node
_type
)
mon
.
collect
(
node
)
process
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
process
=
subprocess
.
Popen
(
CMD
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
output
=
process
.
stdout
.
readlines
()
output
=
process
.
stdout
.
readlines
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
print
(
'Process stopped'
)
print
(
'Process stopped'
)
with
open
(
node
_type
+
'_stats_monitor.pickle'
,
'wb'
)
as
handle
:
with
open
(
node
+
'_stats_monitor.pickle'
,
'wb'
)
as
handle
:
pickle
.
dump
(
mon
.
d
,
handle
,
protocol
=
pickle
.
HIGHEST_PROTOCOL
)
pickle
.
dump
(
mon
.
d
,
handle
,
protocol
=
pickle
.
HIGHEST_PROTOCOL
)
mon
.
graph
(
node_type
)
mon
.
graph
(
node
)
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