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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
lizhongxiao
OpenXG-RAN
Commits
bea2ec5c
Commit
bea2ec5c
authored
Jun 04, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use snprintf() in dump_mac_stats()
parent
f8f20827
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
49 deletions
+67
-49
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+1
-1
openair2/LAYER2/NR_MAC_gNB/main.c
openair2/LAYER2/NR_MAC_gNB/main.c
+66
-48
No files found.
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
bea2ec5c
...
@@ -534,7 +534,7 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
...
@@ -534,7 +534,7 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
void
nr_sr_reporting
(
gNB_MAC_INST
*
nrmac
,
frame_t
frameP
,
sub_frame_t
slotP
);
void
nr_sr_reporting
(
gNB_MAC_INST
*
nrmac
,
frame_t
frameP
,
sub_frame_t
slotP
);
size_t
dump_mac_stats
(
gNB_MAC_INST
*
gNB
,
char
*
output
,
in
t
strlen
,
bool
reset_rsrp
);
size_t
dump_mac_stats
(
gNB_MAC_INST
*
gNB
,
char
*
output
,
size_
t
strlen
,
bool
reset_rsrp
);
void
process_CellGroup
(
NR_CellGroupConfig_t
*
CellGroup
,
NR_UE_sched_ctrl_t
*
sched_ctrl
);
void
process_CellGroup
(
NR_CellGroupConfig_t
*
CellGroup
,
NR_UE_sched_ctrl_t
*
sched_ctrl
);
...
...
openair2/LAYER2/NR_MAC_gNB/main.c
View file @
bea2ec5c
...
@@ -78,11 +78,12 @@ void clear_mac_stats(gNB_MAC_INST *gNB) {
...
@@ -78,11 +78,12 @@ void clear_mac_stats(gNB_MAC_INST *gNB) {
}
}
}
}
size_t
dump_mac_stats
(
gNB_MAC_INST
*
gNB
,
char
*
output
,
in
t
strlen
,
bool
reset_rsrp
)
size_t
dump_mac_stats
(
gNB_MAC_INST
*
gNB
,
char
*
output
,
size_
t
strlen
,
bool
reset_rsrp
)
{
{
int
num
=
1
;
int
num
=
1
;
const
char
*
begin
=
output
;
const
char
*
end
=
output
+
strlen
;
int
stroff
=
0
;
pthread_mutex_lock
(
&
gNB
->
UE_info
.
mutex
);
pthread_mutex_lock
(
&
gNB
->
UE_info
.
mutex
);
UE_iterator
(
gNB
->
UE_info
.
list
,
UE
)
{
UE_iterator
(
gNB
->
UE_info
.
list
,
UE
)
{
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE
->
UE_sched_ctrl
;
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE
->
UE_sched_ctrl
;
...
@@ -90,60 +91,77 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rs
...
@@ -90,60 +91,77 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rs
const
int
avg_rsrp
=
stats
->
num_rsrp_meas
>
0
?
stats
->
cumul_rsrp
/
stats
->
num_rsrp_meas
:
0
;
const
int
avg_rsrp
=
stats
->
num_rsrp_meas
>
0
?
stats
->
cumul_rsrp
/
stats
->
num_rsrp_meas
:
0
;
stroff
+=
sprintf
(
output
+
stroff
,
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)
\n
"
,
output
+=
snprintf
(
output
,
UE
->
rnti
,
end
-
output
,
num
++
,
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)
\n
"
,
sched_ctrl
->
ph
,
UE
->
rnti
,
sched_ctrl
->
pcmax
,
num
++
,
avg_rsrp
,
sched_ctrl
->
ph
,
stats
->
num_rsrp_meas
);
sched_ctrl
->
pcmax
,
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: CQI %d, RI %d, PMI (%d,%d)
\n
"
,
avg_rsrp
,
UE
->
rnti
,
stats
->
num_rsrp_meas
);
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
wb_cqi_1tb
,
output
+=
snprintf
(
output
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
ri
+
1
,
end
-
output
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
pmi_x1
,
"UE %04x: CQI %d, RI %d, PMI (%d,%d)
\n
"
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
pmi_x2
);
UE
->
rnti
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
wb_cqi_1tb
,
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: dlsch_rounds %"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
", dlsch_errors %"
PRIu64
", pucch0_DTX %d, BLER %.5f MCS %d
\n
"
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
ri
+
1
,
UE
->
rnti
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
pmi_x1
,
UE
->
UE_sched_ctrl
.
CSI_report
.
cri_ri_li_pmi_cqi_report
.
pmi_x2
);
stats
->
dl
.
rounds
[
0
],
stats
->
dl
.
rounds
[
1
],
stats
->
dl
.
rounds
[
2
],
stats
->
dl
.
rounds
[
3
],
output
+=
snprintf
(
output
,
stats
->
dl
.
errors
,
end
-
output
,
stats
->
pucch0_DTX
,
"UE %04x: dlsch_rounds %"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
", dlsch_errors %"
PRIu64
", pucch0_DTX %d, BLER %.5f MCS %d
\n
"
,
sched_ctrl
->
dl_bler_stats
.
bler
,
UE
->
rnti
,
sched_ctrl
->
dl_bler_stats
.
mcs
);
stats
->
dl
.
rounds
[
0
],
stats
->
dl
.
rounds
[
1
],
stats
->
dl
.
rounds
[
2
],
stats
->
dl
.
rounds
[
3
],
stats
->
dl
.
errors
,
stats
->
pucch0_DTX
,
sched_ctrl
->
dl_bler_stats
.
bler
,
sched_ctrl
->
dl_bler_stats
.
mcs
);
if
(
reset_rsrp
)
{
if
(
reset_rsrp
)
{
stats
->
num_rsrp_meas
=
0
;
stats
->
num_rsrp_meas
=
0
;
stats
->
cumul_rsrp
=
0
;
stats
->
cumul_rsrp
=
0
;
}
}
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: dlsch_total_bytes %"
PRIu64
"
\n
"
,
UE
->
rnti
,
stats
->
dl
.
total_bytes
);
output
+=
snprintf
(
output
,
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: ulsch_rounds %"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
", ulsch_DTX %d, ulsch_errors %"
PRIu64
", BLER %.5f MCS %d
\n
"
,
end
-
output
,
UE
->
rnti
,
"UE %04x: dlsch_total_bytes %"
PRIu64
"
\n
"
,
stats
->
ul
.
rounds
[
0
],
stats
->
ul
.
rounds
[
1
],
UE
->
rnti
,
stats
->
ul
.
rounds
[
2
],
stats
->
ul
.
rounds
[
3
],
stats
->
dl
.
total_bytes
);
stats
->
ulsch_DTX
,
output
+=
snprintf
(
output
,
stats
->
ul
.
errors
,
end
-
output
,
sched_ctrl
->
ul_bler_stats
.
bler
,
"UE %04x: ulsch_rounds %"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
"/%"
PRIu64
", ulsch_DTX %d, ulsch_errors %"
PRIu64
", BLER %.5f MCS %d
\n
"
,
sched_ctrl
->
ul_bler_stats
.
mcs
);
UE
->
rnti
,
stroff
+=
sprintf
(
output
+
stroff
,
stats
->
ul
.
rounds
[
0
],
stats
->
ul
.
rounds
[
1
],
"UE %04x: ulsch_total_bytes_scheduled %"
PRIu64
", ulsch_total_bytes_received %"
PRIu64
"
\n
"
,
stats
->
ul
.
rounds
[
2
],
stats
->
ul
.
rounds
[
3
],
UE
->
rnti
,
stats
->
ulsch_DTX
,
stats
->
ulsch_total_bytes_scheduled
,
stats
->
ul
.
total_bytes
);
stats
->
ul
.
errors
,
sched_ctrl
->
ul_bler_stats
.
bler
,
sched_ctrl
->
ul_bler_stats
.
mcs
);
output
+=
snprintf
(
output
,
end
-
output
,
"UE %04x: ulsch_total_bytes_scheduled %"
PRIu64
", ulsch_total_bytes_received %"
PRIu64
"
\n
"
,
UE
->
rnti
,
stats
->
ulsch_total_bytes_scheduled
,
stats
->
ul
.
total_bytes
);
for
(
int
lc_id
=
0
;
lc_id
<
63
;
lc_id
++
)
{
for
(
int
lc_id
=
0
;
lc_id
<
63
;
lc_id
++
)
{
if
(
stats
->
dl
.
lc_bytes
[
lc_id
]
>
0
)
{
if
(
stats
->
dl
.
lc_bytes
[
lc_id
]
>
0
)
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: LCID %d: %"
PRIu64
" bytes TX
\n
"
,
UE
->
rnti
,
lc_id
,
stats
->
dl
.
lc_bytes
[
lc_id
]);
output
+=
snprintf
(
output
,
LOG_D
(
NR_MAC
,
"UE %04x: LCID %d: %"
PRIu64
" bytes TX
\n
"
,
UE
->
rnti
,
lc_id
,
stats
->
dl
.
lc_bytes
[
lc_id
]);
end
-
output
,
}
"UE %04x: LCID %d: %"
PRIu64
" bytes TX
\n
"
,
if
(
stats
->
ul
.
lc_bytes
[
lc_id
]
>
0
)
{
UE
->
rnti
,
stroff
+=
sprintf
(
output
+
stroff
,
"UE %04x: LCID %d: %"
PRIu64
" bytes RX
\n
"
,
UE
->
rnti
,
lc_id
,
stats
->
ul
.
lc_bytes
[
lc_id
]);
lc_id
,
LOG_D
(
NR_MAC
,
"UE %04x: LCID %d: %"
PRIu64
" bytes RX
\n
"
,
UE
->
rnti
,
lc_id
,
stats
->
ul
.
lc_bytes
[
lc_id
]);
stats
->
dl
.
lc_bytes
[
lc_id
]);
if
(
stats
->
ul
.
lc_bytes
[
lc_id
]
>
0
)
}
output
+=
snprintf
(
output
,
end
-
output
,
"UE %04x: LCID %d: %"
PRIu64
" bytes RX
\n
"
,
UE
->
rnti
,
lc_id
,
stats
->
ul
.
lc_bytes
[
lc_id
]);
}
}
}
}
pthread_mutex_unlock
(
&
gNB
->
UE_info
.
mutex
);
pthread_mutex_unlock
(
&
gNB
->
UE_info
.
mutex
);
return
stroff
;
return
output
-
begin
;
}
}
...
...
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