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
常顺宇
OpenXG-RAN
Commits
e4560d8a
Commit
e4560d8a
authored
Feb 15, 2019
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/issue397_telnet_stats' into develop_integration_2019_w07_v2
parents
4cdae9d9
5a519297
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
559 additions
and
51 deletions
+559
-51
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+17
-8
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+2
-1
common/utils/telnetsrv/telnetsrv_CMakeLists.txt
common/utils/telnetsrv/telnetsrv_CMakeLists.txt
+1
-0
common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
+99
-0
common/utils/telnetsrv/telnetsrv_measurements.c
common/utils/telnetsrv/telnetsrv_measurements.c
+316
-0
common/utils/telnetsrv/telnetsrv_measurements.h
common/utils/telnetsrv/telnetsrv_measurements.h
+88
-0
openair1/PHY/TOOLS/time_meas.c
openair1/PHY/TOOLS/time_meas.c
+21
-18
openair1/PHY/TOOLS/time_meas.h
openair1/PHY/TOOLS/time_meas.h
+15
-24
No files found.
common/utils/telnetsrv/telnetsrv.c
View file @
e4560d8a
...
...
@@ -58,7 +58,7 @@
#include "telnetsrv_phycmd.h"
#include "telnetsrv_proccmd.h"
static
char
*
telnet_defstatmod
[]
=
{
"softmodem"
,
"phy"
,
"loader"
};
static
char
*
telnet_defstatmod
[]
=
{
"softmodem"
,
"phy"
,
"loader"
,
"measur"
};
static
telnetsrv_params_t
telnetparams
;
#define TELNETSRV_LISTENADDR 0
#define TELNETSRV_LISTENPORT 1
...
...
@@ -500,23 +500,32 @@ int process_command(char *buf) {
}
/* else */
}
/* strncmp: module name test */
else
if
(
strncasecmp
(
modulename
,
"loop"
,
4
)
==
0
)
{
int
lc
;
int
f
=
fcntl
(
telnetparams
.
new_socket
,
F_GETFL
);
fcntl
(
telnetparams
.
new_socket
,
F_SETFL
,
O_NONBLOCK
|
f
);
int
f1
=
fcntl
(
telnetparams
.
new_socket
,
F_SETFL
,
O_NONBLOCK
|
f
);
for
(
lc
=
0
;
lc
<
telnetparams
.
loopcount
;
lc
++
)
{
if
(
f
<
0
||
f1
<
0
)
{
client_printf
(
" Loop won't be cancelable: %s
\n
"
,
strerror
(
errno
)
);
}
for
(
int
lc
=
0
;
lc
<
telnetparams
.
loopcount
;
lc
++
)
{
char
dummybuff
[
20
];
char
tbuff
[
64
];
int
rs
;
client_printf
(
CSI
"1J"
CSI
"1;10H "
STDFMT
"%s %i/%i
\n
"
,
get_time
(
tbuff
,
sizeof
(
tbuff
)),
lc
,
telnetparams
.
loopcount
);
process_command
(
bufbck
+
strlen
(
"loop"
)
+
1
);
usleep
(
telnetparams
.
loopdelay
*
1000
)
;
rs
=
read
(
telnetparams
.
new_socket
,
dummybuff
,
sizeof
(
dummybuff
));
errno
=
0
;
int
rs
=
read
(
telnetparams
.
new_socket
,
dummybuff
,
sizeof
(
dummybuff
));
if
(
rs
>
0
)
{
if
(
telnetparams
.
telnetdbg
>
0
)
client_printf
(
"Received
\"
%s
\"
status %d, errno %s while running loop
\n
"
,
dummybuff
,
rs
,
strerror
(
errno
));
if
(
errno
!=
EAGAIN
&&
errno
!=
EWOULDBLOCK
)
{
client_printf
(
STDFMT
" Loop canceled, iteration %i/%i
\n
"
,
lc
,
telnetparams
.
loopcount
);
lc
=
telnetparams
.
loopcount
;
break
;
}
usleep
(
telnetparams
.
loopdelay
*
1000
);
}
fcntl
(
telnetparams
.
new_socket
,
F_SETFL
,
f
);
...
...
common/utils/telnetsrv/telnetsrv.h
View file @
e4560d8a
...
...
@@ -69,7 +69,8 @@ typedef struct cmddef {
#define TELNET_VARTYPE_INT64 3
#define TELNET_VARTYPE_STRING 4
#define TELNET_VARTYPE_DOUBLE 5
//#define TELNET_VARTYPE_PTR 6
#define TELNET_VARTYPE_INT8 6
#define TELNET_VARTYPE_UINT 7
typedef
struct
variabledef
{
char
varname
[
TELNET_CMD_MAXSIZE
];
char
vartype
;
...
...
common/utils/telnetsrv/telnetsrv_CMakeLists.txt
View file @
e4560d8a
...
...
@@ -9,6 +9,7 @@ set(TELNETSRV_SOURCE
${TELNETROOT}/telnetsrv_phycmd.c
${TELNETROOT}/telnetsrv_proccmd.c
${TELNETROOT}/telnetsrv_loader.c
${TELNETROOT}/telnetsrv_measurements.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
...
...
common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
0 → 100644
View file @
e4560d8a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
* \brief: definitions of macro used to initialize the telnet_ltemeasurdef_t
* \ strucures arrays which are then used by the display functions
* \ in telnetsrv_measurements.c.
* \author Francois TABURET
* \date 2019
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define CPU_PHYENB_MEASURE \
{ \
{"phy_proc_tx", &(phyvars->phy_proc_tx),0},\
{"phy_proc_rx", &(phyvars->phy_proc_rx),0},\
{"rx_prach", &(phyvars->rx_prach),0},\
{"ofdm_mod", &(phyvars->ofdm_mod_stats),0},\
{"dlsch_common_and_dci", &(phyvars->dlsch_common_and_dci),0},\
{"dlsch_ue_specific", &(phyvars->dlsch_ue_specific),0},\
{"dlsch_encoding", &(phyvars->dlsch_encoding_stats),0},\
{"dlsch_modulation", &(phyvars->dlsch_modulation_stats),0},\
{"dlsch_scrambling", &(phyvars->dlsch_scrambling_stats),0},\
{"dlsch_rate_matching", &(phyvars->dlsch_rate_matching_stats),0},\
{"dlsch_turbo_encod_prep", &(phyvars->dlsch_turbo_encoding_preperation_stats),0},\
{"dlsch_turbo_encod_segm", &(phyvars->dlsch_turbo_encoding_segmentation_stats),0},\
{"dlsch_turbo_encod", &(phyvars->dlsch_turbo_encoding_stats),0},\
{"dlsch_turbo_encod_waiting", &(phyvars->dlsch_turbo_encoding_waiting_stats),0},\
{"dlsch_turbo_encod_signal", &(phyvars->dlsch_turbo_encoding_signal_stats),0},\
{"dlsch_turbo_encod_main", &(phyvars->dlsch_turbo_encoding_main_stats),0},\
{"dlsch_turbo_encod_wakeup0", &(phyvars->dlsch_turbo_encoding_wakeup_stats0),0},\
{"dlsch_turbo_encod_wakeup1", &(phyvars->dlsch_turbo_encoding_wakeup_stats1),0},\
{"dlsch_interleaving", &(phyvars->dlsch_interleaving_stats),0},\
{"rx_dft", &(phyvars->rx_dft_stats),0},\
{"ulsch_channel_estimation", &(phyvars->ulsch_channel_estimation_stats),0},\
{"ulsch_freq_offset_estimation", &(phyvars->ulsch_freq_offset_estimation_stats),0},\
{"ulsch_decoding", &(phyvars->ulsch_decoding_stats),0},\
{"ulsch_demodulation", &(phyvars->ulsch_demodulation_stats),0},\
{"ulsch_rate_unmatching", &(phyvars->ulsch_rate_unmatching_stats),0},\
{"ulsch_turbo_decoding", &(phyvars->ulsch_turbo_decoding_stats),0},\
{"ulsch_deinterleaving", &(phyvars->ulsch_deinterleaving_stats),0},\
{"ulsch_demultiplexing", &(phyvars->ulsch_demultiplexing_stats),0},\
{"ulsch_llr", &(phyvars->ulsch_llr_stats),0},\
{"ulsch_tc_init", &(phyvars->ulsch_tc_init_stats),0},\
{"ulsch_tc_alpha", &(phyvars->ulsch_tc_alpha_stats),0},\
{"ulsch_tc_beta", &(phyvars->ulsch_tc_beta_stats),0},\
{"ulsch_tc_gamma", &(phyvars->ulsch_tc_gamma_stats),0},\
{"ulsch_tc_ext", &(phyvars->ulsch_tc_ext_stats),0},\
{"ulsch_tc_intl1", &(phyvars->ulsch_tc_intl1_stats),0},\
{"ulsch_tc_intl2", &(phyvars->ulsch_tc_intl2_stats),0},\
}
#define CPU_MACENB_MEASURE \
{ \
{"eNB_scheduler", &(macvars->eNB_scheduler),0},\
{"schedule_si", &(macvars->schedule_si),0},\
{"schedule_ra", &(macvars->schedule_ra),0},\
{"schedule_ulsch", &(macvars->schedule_ulsch),0},\
{"fill_DLSCH_dci", &(macvars->fill_DLSCH_dci),0},\
{"schedule_dlsch_pre", &(macvars->schedule_dlsch_preprocessor),0},\
{"schedule_dlsch", &(macvars->schedule_dlsch),0},\
{"schedule_mch", &(macvars->schedule_mch),0},\
{"rx_ulsch_sdu", &(macvars->rx_ulsch_sdu),0},\
{"schedule_pch", &(macvars->schedule_pch),0},\
}
#define CPU_PDCPENB_MEASURE \
{ \
{"pdcp_run", &(pdcpvars->pdcp_run),0},\
{"data_req", &(pdcpvars->data_req),0},\
{"data_ind", &(pdcpvars->data_ind),0},\
{"apply_security", &(pdcpvars->apply_security),0},\
{"validate_security", &(pdcpvars->validate_security),0},\
{"pdcp_ip", &(pdcpvars->pdcp_ip),0},\
{"ip_pdcp", &(pdcpvars->ip_pdcp),0},\
}
common/utils/telnetsrv/telnetsrv_measurements.c
0 → 100644
View file @
e4560d8a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
* \brief: implementation of telnet commands related to measurments
* \author Francois TABURET
* \date 2019
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#define TELNETSERVERCODE
#include "telnetsrv.h"
#define TELNETSRV_MEASURMENTS_MAIN
#include "common/utils/LOG/log.h"
#include "common/config/config_userapi.h"
#include "telnetsrv_measurements.h"
#include "telnetsrv_ltemeasur_def.h"
#include "telnetsrv_cpumeasur_def.h"
#include "openair2/LAYER2/MAC/mac.h"
#include "openair1/PHY/phy_extern.h"
void
measurcmd_display_macstats
(
telnet_printfunc_t
prnt
);
void
measurcmd_display_macstats_ue
(
telnet_printfunc_t
prnt
);
void
measurcmd_display_rlcstats
(
telnet_printfunc_t
prnt
);
void
measurcmd_display_phycpu
(
telnet_printfunc_t
prnt
);
void
measurcmd_display_maccpu
(
telnet_printfunc_t
prnt
);
void
measurcmd_display_pdcpcpu
(
telnet_printfunc_t
prnt
);
static
telnet_measurgroupdef_t
measurgroups
[]
=
{
{
"enb"
,
GROUP_LTESTATS
,
0
,
measurcmd_display_macstats
,
{
NULL
}},
{
"enbues"
,
GROUP_LTESTATS
,
0
,
measurcmd_display_macstats_ue
,{
NULL
}},
{
"rlc"
,
GROUP_LTESTATS
,
0
,
measurcmd_display_rlcstats
,
{
NULL
}},
{
"phycpu"
,
GROUP_CPUSTATS
,
0
,
measurcmd_display_phycpu
,
{
NULL
}},
{
"maccpu"
,
GROUP_CPUSTATS
,
0
,
measurcmd_display_maccpu
,
{
NULL
}},
{
"pdcpcpu"
,
GROUP_CPUSTATS
,
0
,
measurcmd_display_pdcpcpu
,
{
NULL
}},
};
#define TELNET_NUM_MEASURGROUPS (sizeof(measurgroups)/sizeof(telnet_measurgroupdef_t))
static
int
eNB_id
=
0
;
static
char
*
grouptypes
[]
=
{
"ltestats"
,
"cpustats"
};
static
double
cpufreq
;
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
#define HDR "---------------------------------"
void
measurcmd_display_groups
(
telnet_printfunc_t
prnt
)
{
prnt
(
" %*s %10s %s
\n
"
,
TELNET_MAXMEASURNAME_LEN
-
1
,
"name"
,
"type"
,
"nombre de mesures"
);
for
(
int
i
=
0
;
i
<
TELNET_NUM_MEASURGROUPS
;
i
++
)
prnt
(
"%02d %*s %10s %i
\n
"
,
i
,
TELNET_MAXMEASURNAME_LEN
-
1
,
measurgroups
[
i
].
groupname
,
grouptypes
[
measurgroups
[
i
].
type
],
measurgroups
[
i
].
size
);
}
/* measurcmd_display_groups */
/*----------------------------------------------------------------------------------------------------*/
/* cpu measurements functions */
void
measurcmd_display_cpumeasures
(
telnet_printfunc_t
prnt
,
telnet_cpumeasurdef_t
*
cpumeasure
,
int
cpumeasure_size
)
{
for
(
int
i
=
0
;
i
<
cpumeasure_size
;
i
++
)
{
prnt
(
"%02d %*s: %15.3f us; %15d %s"
,
i
,
TELNET_MAXMEASURNAME_LEN
-
1
,(
cpumeasure
+
i
)
->
statname
,
((
cpumeasure
+
i
)
->
astatptr
->
trials
!=
0
)
?
(((
cpumeasure
+
i
)
->
astatptr
->
diff
)
/
((
cpumeasure
+
i
)
->
astatptr
->
trials
))
/
cpufreq
/
1000
:
0
,
(
cpumeasure
+
i
)
->
astatptr
->
trials
,
((
i
%
2
)
==
1
)
?
"|
\n
"
:
" | "
);
}
prnt
(
"
\n\n
"
);
}
/* measurcmd_display_measures */
#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
void
measurcmd_display_phycpu
(
telnet_printfunc_t
prnt
)
{
PHY_VARS_eNB
*
phyvars
=
RC
.
eNB
[
eNB_id
][
0
];
telnet_cpumeasurdef_t
cpumeasur
[]
=
CPU_PHYENB_MEASURE
;
prnt
(
"%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s
\n
"
,
HDR
,
cpufreq
,
PRINT_CPUMEAS_STATE
,
HDR
);
measurcmd_display_cpumeasures
(
prnt
,
cpumeasur
,
sizeof
(
cpumeasur
)
/
sizeof
(
telnet_cpumeasurdef_t
));
}
void
measurcmd_display_maccpu
(
telnet_printfunc_t
prnt
)
{
eNB_MAC_INST
*
macvars
=
RC
.
mac
[
eNB_id
];
telnet_cpumeasurdef_t
cpumeasur
[]
=
CPU_MACENB_MEASURE
;
prnt
(
"%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s
\n
"
,
HDR
,
cpufreq
,
PRINT_CPUMEAS_STATE
,
HDR
);
measurcmd_display_cpumeasures
(
prnt
,
cpumeasur
,
sizeof
(
cpumeasur
)
/
sizeof
(
telnet_cpumeasurdef_t
));
}
void
measurcmd_display_pdcpcpu
(
telnet_printfunc_t
prnt
)
{
pdcp_stats_t
*
pdcpvars
=
&
(
eNB_pdcp_stats
[
eNB_id
]);
telnet_cpumeasurdef_t
cpumeasur
[]
=
CPU_PDCPENB_MEASURE
;
prnt
(
"%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s
\n
"
,
HDR
,
cpufreq
,
PRINT_CPUMEAS_STATE
,
HDR
);
measurcmd_display_cpumeasures
(
prnt
,
cpumeasur
,
sizeof
(
cpumeasur
)
/
sizeof
(
telnet_cpumeasurdef_t
));
}
/*----------------------------------------------------------------------------------------------------*/
/* lte measurements functions */
uint64_t
measurcmd_getstatvalue
(
telnet_ltemeasurdef_t
*
measur
,
telnet_printfunc_t
prnt
)
{
uint64_t
val
;
switch
(
measur
->
vtyp
)
{
case
TELNET_VARTYPE_INT64
:
val
=
(
uint64_t
)(
*
((
uint64_t
*
)(
measur
->
vptr
)));
break
;
case
TELNET_VARTYPE_INT32
:
val
=
(
uint64_t
)(
*
((
uint32_t
*
)(
measur
->
vptr
)));
break
;
case
TELNET_VARTYPE_INT16
:
val
=
(
uint64_t
)(
*
((
uint16_t
*
)(
measur
->
vptr
)));
break
;
case
TELNET_VARTYPE_INT8
:
val
=
(
uint64_t
)(
*
((
uint8_t
*
)(
measur
->
vptr
)));
break
;
case
TELNET_VARTYPE_UINT
:
val
=
(
uint64_t
)(
*
((
unsigned
int
*
)(
measur
->
vptr
)));
break
;
default:
prnt
(
"%s %i: unknown type
\n
"
,
measur
->
statname
,
measur
->
vtyp
);
val
=
(
uint64_t
)(
*
((
uint64_t
*
)(
measur
->
vptr
)));
break
;
}
return
val
;
}
/* measurcmd_getstatvalue */
void
measurcmd_display_measures
(
telnet_printfunc_t
prnt
,
telnet_ltemeasurdef_t
*
statsptr
,
int
stats_size
)
{
for
(
int
i
=
0
;
i
<
stats_size
;
i
++
)
{
prnt
(
"%*s = %15llu%s"
,
TELNET_MAXMEASURNAME_LEN
-
1
,
statsptr
[
i
].
statname
,
measurcmd_getstatvalue
(
&
(
statsptr
[
i
]),
prnt
),
((
i
%
3
)
==
2
)
?
"
\n
"
:
" "
);
}
prnt
(
"
\n\n
"
);
}
/* measurcmd_display_measures */
void
measurcmd_display_macstats_ue
(
telnet_printfunc_t
prnt
)
{
UE_list_t
*
UE_list
=
&
(
RC
.
mac
[
eNB_id
]
->
UE_list
);
for
(
int
UE_id
=
UE_list
->
head
;
UE_id
>=
0
;
UE_id
=
UE_list
->
next
[
UE_id
])
{
for
(
int
i
=
0
;
i
<
UE_list
->
numactiveCCs
[
UE_id
];
i
++
)
{
int
CC_id
=
UE_list
->
ordered_CCids
[
i
][
UE_id
];
prnt
(
"%s UE %i Id %i CCid %i %s
\n
"
,
HDR
,
i
,
UE_id
,
CC_id
,
HDR
);
eNB_UE_STATS
*
macuestatptr
=
&
(
UE_list
->
eNB_UE_stats
[
CC_id
][
UE_id
]);
telnet_ltemeasurdef_t
statsptr
[]
=
LTEMAC_UEMEASURE
;
measurcmd_display_measures
(
prnt
,
statsptr
,
sizeof
(
statsptr
)
/
sizeof
(
telnet_ltemeasurdef_t
));
}
}
}
/* measurcmd_display_macstats_ue */
void
measurcmd_display_macstats
(
telnet_printfunc_t
prnt
)
{
for
(
int
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
eNB_STATS
*
macstatptr
=&
(
RC
.
mac
[
eNB_id
]
->
eNB_stats
[
CC_id
]);
telnet_ltemeasurdef_t
statsptr
[]
=
LTEMAC_MEASURE
;
prnt
(
"%s eNB %i mac stats CC %i frame %u %s
\n
"
,
HDR
,
eNB_id
,
CC_id
,
RC
.
mac
[
eNB_id
]
->
frame
,
HDR
);
measurcmd_display_measures
(
prnt
,
statsptr
,
sizeof
(
statsptr
)
/
sizeof
(
telnet_ltemeasurdef_t
));
}
}
/* measurcmd_display_macstats */
void
measurcmd_display_one_rlcstat
(
telnet_printfunc_t
prnt
,
int
UE_id
,
telnet_ltemeasurdef_t
*
statsptr
,
int
num_rlcmeasure
,
unsigned
int
*
rlcstats
,
char
*
rbid_str
,
protocol_ctxt_t
*
ctxt
,
const
srb_flag_t
srb_flagP
,
const
rb_id_t
rb_idP
)
{
int
rlc_status
=
rlc_stat_req
(
ctxt
,
srb_flagP
,
rb_idP
,
rlcstats
,
rlcstats
+
1
,
rlcstats
+
2
,
rlcstats
+
3
,
rlcstats
+
4
,
rlcstats
+
5
,
rlcstats
+
6
,
rlcstats
+
7
,
rlcstats
+
8
,
rlcstats
+
9
,
rlcstats
+
10
,
rlcstats
+
11
,
rlcstats
+
12
,
rlcstats
+
13
,
rlcstats
+
14
,
rlcstats
+
15
,
rlcstats
+
16
,
rlcstats
+
17
,
rlcstats
+
18
,
rlcstats
+
19
,
rlcstats
+
20
,
rlcstats
+
21
,
rlcstats
+
22
,
rlcstats
+
23
,
rlcstats
+
24
,
rlcstats
+
25
,
rlcstats
+
26
,
rlcstats
+
27
);
if
(
rlc_status
==
RLC_OP_STATUS_OK
)
{
prnt
(
"%s UE %i RLC %s mode %s %s
\n
"
,
HDR
,
UE_id
,
rbid_str
,
(
rlcstats
[
0
]
==
RLC_MODE_AM
)
?
"AM"
:
(
rlcstats
[
0
]
==
RLC_MODE_UM
)
?
"UM"
:
"NONE"
,
HDR
);
measurcmd_display_measures
(
prnt
,
statsptr
,
num_rlcmeasure
);
}
}
/* status measurcmd_rlc_stat_req */
void
measurcmd_display_rlcstats
(
telnet_printfunc_t
prnt
)
{
protocol_ctxt_t
ctxt
;
UE_list_t
*
UE_list
=
&
(
RC
.
mac
[
eNB_id
]
->
UE_list
);
telnet_ltemeasurdef_t
statsptr
[]
=
LTE_RLCMEASURE
;
int
num_rlcmeasure
=
sizeof
(
statsptr
)
/
sizeof
(
telnet_ltemeasurdef_t
);
unsigned
int
*
rlcstats
=
malloc
(
num_rlcmeasure
*
sizeof
(
unsigned
int
));
eNB_MAC_INST
*
eNB
=
RC
.
mac
[
eNB_id
];
for
(
int
i
=
0
;
i
<
num_rlcmeasure
;
i
++
)
{
statsptr
[
i
].
vptr
=
rlcstats
+
i
;
}
for
(
int
UE_id
=
UE_list
->
head
;
UE_id
>=
0
;
UE_id
=
UE_list
->
next
[
UE_id
])
{
#define NB_eNB_INST 1
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
eNB_id
,
ENB_FLAG_YES
,
UE_list
->
eNB_UE_stats
[
0
][
UE_id
].
crnti
,
eNB
->
frame
,
eNB
->
subframe
,
eNB_id
);
measurcmd_display_one_rlcstat
(
prnt
,
UE_id
,
statsptr
,
num_rlcmeasure
,
rlcstats
,
"DCCH"
,
&
ctxt
,
SRB_FLAG_YES
,
DCCH
);
measurcmd_display_one_rlcstat
(
prnt
,
UE_id
,
statsptr
,
num_rlcmeasure
,
rlcstats
,
"DTCH"
,
&
ctxt
,
SRB_FLAG_NO
,
DTCH
-
2
);
}
}
/* measurcmd_display_macstats_ue */
/*------------------------------------------------------------------------------------------------------------------------*/
/* function called by the telnet server when measur command is entered */
int
measurcmd_show
(
char
*
buf
,
int
debug
,
telnet_printfunc_t
prnt
)
{
char
*
subcmd
=
NULL
;
int
idx1
,
idx2
;
int
badcmd
=
1
;
if
(
debug
>
0
)
prnt
(
" measurcmd_show received %s
\n
"
,
buf
);
// char tmp[20480];
// dump_eNB_l2_stats(tmp, 0);
// prnt("%s\n",tmp);
int
s
=
sscanf
(
buf
,
"%ms %i-%i
\n
"
,
&
subcmd
,
&
idx1
,
&
idx2
);
if
(
s
>
0
)
{
if
(
strcmp
(
subcmd
,
"groups"
)
==
0
)
{
measurcmd_display_groups
(
prnt
);
badcmd
=
0
;
}
else
{
for
(
int
i
=
0
;
i
<
TELNET_NUM_MEASURTYPES
;
i
++
)
{
if
(
strcmp
(
subcmd
,
grouptypes
[
i
])
==
0
)
{
for
(
int
j
=
0
;
j
<
TELNET_NUM_MEASURGROUPS
;
j
++
)
{
if
(
i
==
measurgroups
[
j
].
type
)
{
badcmd
=
0
;
measurgroups
[
j
].
displayfunc
(
prnt
);
}
}
/* for j...*/
}
}
/* for i...*/
for
(
int
i
=
0
;
i
<
TELNET_NUM_MEASURGROUPS
;
i
++
)
{
if
(
strcmp
(
subcmd
,
measurgroups
[
i
].
groupname
)
==
0
)
{
measurgroups
[
i
].
displayfunc
(
prnt
);
badcmd
=
0
;
break
;
}
}
}
free
(
subcmd
);
}
/* s>0 */
if
(
badcmd
)
{
prnt
(
"%s: unknown measur command
\n
"
,
buf
);
}
return
CMDSTATUS_FOUND
;
}
int
measurcmd_cpustats
(
char
*
buf
,
int
debug
,
telnet_printfunc_t
prnt
)
{
char
*
subcmd
=
NULL
;
int
idx1
,
idx2
;
int
badcmd
=
1
;
if
(
debug
>
0
)
prnt
(
" measurcmd_show received %s
\n
"
,
buf
);
int
s
=
sscanf
(
buf
,
"%ms %i-%i
\n
"
,
&
subcmd
,
&
idx1
,
&
idx2
);
if
(
s
>
0
)
{
if
(
strcmp
(
subcmd
,
"enable"
)
==
0
)
{
cpumeas
(
CPUMEAS_ENABLE
);
badcmd
=
0
;
}
else
if
(
strcmp
(
subcmd
,
"disable"
)
==
0
)
{
cpumeas
(
CPUMEAS_DISABLE
);
badcmd
=
0
;
}
}
if
(
badcmd
)
{
prnt
(
"Cpu measurments state: %s
\n
"
,
PRINT_CPUMEAS_STATE
);
}
free
(
subcmd
);
return
CMDSTATUS_FOUND
;
}
/*-------------------------------------------------------------------------------------*/
/* function called at telnet server init to add the measur command */
void
add_measur_cmds
(
void
)
{
add_telnetcmd
(
"measur"
,
measur_vardef
,
measur_cmdarray
);
cpufreq
=
get_cpu_freq_GHz
();
}
common/utils/telnetsrv/telnetsrv_measurements.h
0 → 100644
View file @
e4560d8a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_measurements.h
* \brief: Include file defining constants, structures and function prototypes
* \ used to implement the measurements functionality of the telnet server
* \author Francois TABURET
* \date 2019
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#include <dlfcn.h>
#include "telnetsrv.h"
#include "openair1/PHY/defs_eNB.h"
#ifdef TELNETSRV_MEASURMENTS_MAIN
#define TELNET_MAXMEASURNAME_LEN 30
#define TELNET_MAXMEASURGROUPS 10
telnetshell_vardef_t
measur_vardef
[]
=
{
{
""
,
0
,
NULL
}
};
typedef
struct
cpumeasurdef
{
char
statname
[
TELNET_MAXMEASURNAME_LEN
];
time_stats_t
*
astatptr
;
unsigned
int
statemask
;
}
telnet_cpumeasurdef_t
;
typedef
struct
ltemeasurdef
{
char
statname
[
TELNET_MAXMEASURNAME_LEN
];
void
*
vptr
;
char
vtyp
;
unsigned
int
statemask
;
}
telnet_ltemeasurdef_t
;
#define GROUP_LTESTATS 0
#define GROUP_CPUSTATS 1
typedef
void
(
*
measur_dislayfunc_t
)(
telnet_printfunc_t
prnt
);
typedef
struct
mesurgroupdef
{
char
groupname
[
TELNET_MAXMEASURNAME_LEN
];
unsigned
char
type
;
unsigned
char
size
;
measur_dislayfunc_t
displayfunc
;
union
{
telnet_cpumeasurdef_t
*
cpustats
;
telnet_ltemeasurdef_t
*
ltestats
;
};
}
telnet_measurgroupdef_t
;
#define MACSTATS_NAME(valptr) #valptr
#define LTEMAC_MEASURGROUP_NAME "ltemac"
#define PHYCPU_MEASURGROUP_NAME "phycpu"
int
measurcmd_show
(
char
*
buf
,
int
debug
,
telnet_printfunc_t
prnt
);
int
measurcmd_cpustats
(
char
*
buf
,
int
debug
,
telnet_printfunc_t
prnt
);
telnetshell_cmddef_t
measur_cmdarray
[]
=
{
{
"show"
,
"groups | <group name>"
,
measurcmd_show
},
{
"cpustats"
,
"[enable | disable]"
,
measurcmd_cpustats
},
{
""
,
""
,
NULL
}
};
#else
extern
void
add_measur_cmds
(
void
);
#endif
/* TELNETSRV_MEASURCMD_MAIN */
openair1/PHY/TOOLS/time_meas.c
View file @
e4560d8a
...
...
@@ -29,7 +29,6 @@ int opp_enabled = 0;
double
get_cpu_freq_GHz
(
void
)
{
time_stats_t
ts
=
{
0
};
reset_meas
(
&
ts
);
ts
.
trials
++
;
...
...
@@ -38,32 +37,40 @@ double get_cpu_freq_GHz(void) {
ts
.
diff
=
(
rdtsc_oai
()
-
ts
.
in
);
cpu_freq_GHz
=
(
double
)
ts
.
diff
/
1000000000
;
printf
(
"CPU Freq is %f
\n
"
,
cpu_freq_GHz
);
return
cpu_freq_GHz
;
return
cpu_freq_GHz
;
}
int
cpumeas
(
int
action
)
{
switch
(
action
)
{
case
CPUMEAS_ENABLE
:
opp_enabled
=
1
;
break
;
case
CPUMEAS_DISABLE
:
opp_enabled
=
0
;
break
;
case
CPUMEAS_GETSTATE
:
default:
break
;
}
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
){
return
opp_enabled
;
}
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
)
{
if
(
opp_enabled
)
{
//static double cpu_freq_GHz = 3.2;
//if (cpu_freq_GHz == 0.0)
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
if
(
ts
->
trials
>
0
)
{
//fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->p_time/(cpu_freq_GHz*1000000.0)),subframe,ts->p_time);
fprintf
(
file_name
,
"%15.3f us, diff_now %15.3f
\n
"
,(
ts
->
p_time
/
(
cpu_freq_GHz
*
1000
.
0
)),(
double
)
ts
->
p_time
);
}
}
}
void
print_meas
(
time_stats_t
*
ts
,
const
char
*
name
,
time_stats_t
*
total_exec_time
,
time_stats_t
*
sf_exec_time
)
{
void
print_meas
(
time_stats_t
*
ts
,
const
char
*
name
,
time_stats_t
*
total_exec_time
,
time_stats_t
*
sf_exec_time
)
{
if
(
opp_enabled
)
{
static
int
first_time
=
0
;
static
double
cpu_freq_GHz
=
0
.
0
;
...
...
@@ -81,7 +88,6 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
if
(
ts
->
trials
>
0
)
{
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
if
((
total_exec_time
==
NULL
)
||
(
sf_exec_time
==
NULL
))
{
fprintf
(
stderr
,
"%25s: %15.3f us; %15d;
\n
"
,
name
,
...
...
@@ -98,12 +104,9 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
}
}
}
}
double
get_time_meas_us
(
time_stats_t
*
ts
)
{
double
get_time_meas_us
(
time_stats_t
*
ts
)
{
static
double
cpu_freq_GHz
=
0
.
0
;
if
(
cpu_freq_GHz
==
0
.
0
)
...
...
openair1/PHY/TOOLS/time_meas.h
View file @
e4560d8a
...
...
@@ -61,23 +61,21 @@ static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
static
inline
void
stop_meas
(
time_stats_t
*
ts
)
__attribute__
((
always_inline
));
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
);
void
print_meas
(
time_stats_t
*
ts
,
const
char
*
name
,
time_stats_t
*
total_exec_time
,
time_stats_t
*
sf_exec_time
);
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
);
void
print_meas
(
time_stats_t
*
ts
,
const
char
*
name
,
time_stats_t
*
total_exec_time
,
time_stats_t
*
sf_exec_time
);
double
get_time_meas_us
(
time_stats_t
*
ts
);
double
get_cpu_freq_GHz
(
void
);
#if defined(__i386__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
unsigned
long
long
int
x
;
__asm__
volatile
(
".byte 0x0f, 0x31"
:
"=A"
(
x
));
return
x
;
}
#elif defined(__x86_64__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
unsigned
long
long
a
,
d
;
__asm__
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
return
(
d
<<
32
)
|
a
;
...
...
@@ -85,61 +83,54 @@ static inline unsigned long long rdtsc_oai(void)
#elif defined(__arm__)
static
inline
uint32_t
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
uint32_t
rdtsc_oai
(
void
)
{
static
inline
uint32_t
rdtsc_oai
(
void
)
{
uint32_t
r
=
0
;
asm
volatile
(
"mrc p15, 0, %0, c9, c13, 0"
:
"=r"
(
r
)
);
return
r
;
}
#endif
static
inline
void
start_meas
(
time_stats_t
*
ts
)
{
#define CPUMEAS_DISABLE 0
#define CPUMEAS_ENABLE 1
#define CPUMEAS_GETSTATE 2
int
cpumeas
(
int
action
);
static
inline
void
start_meas
(
time_stats_t
*
ts
)
{
if
(
opp_enabled
)
{
if
(
ts
->
meas_flag
==
0
)
{
ts
->
trials
++
;
ts
->
in
=
rdtsc_oai
();
ts
->
meas_flag
=
1
;
}
else
{
}
else
{
ts
->
in
=
rdtsc_oai
();
}
}
}
static
inline
void
stop_meas
(
time_stats_t
*
ts
)
{
static
inline
void
stop_meas
(
time_stats_t
*
ts
)
{
if
(
opp_enabled
)
{
long
long
out
=
rdtsc_oai
();
ts
->
diff
+=
(
out
-
ts
->
in
);
/// process duration is the difference between two clock points
ts
->
p_time
=
(
out
-
ts
->
in
);
ts
->
diff_square
+=
(
out
-
ts
->
in
)
*
(
out
-
ts
->
in
);
if
((
out
-
ts
->
in
)
>
ts
->
max
)
ts
->
max
=
out
-
ts
->
in
;
ts
->
meas_flag
=
0
;
ts
->
meas_flag
=
0
;
}
}
static
inline
void
reset_meas
(
time_stats_t
*
ts
)
{
ts
->
trials
=
0
;
ts
->
diff
=
0
;
ts
->
p_time
=
0
;
ts
->
diff_square
=
0
;
ts
->
max
=
0
;
ts
->
meas_flag
=
0
;
}
static
inline
void
copy_meas
(
time_stats_t
*
dst_ts
,
time_stats_t
*
src_ts
)
{
static
inline
void
copy_meas
(
time_stats_t
*
dst_ts
,
time_stats_t
*
src_ts
)
{
if
(
opp_enabled
)
{
dst_ts
->
trials
=
src_ts
->
trials
;
dst_ts
->
diff
=
src_ts
->
diff
;
...
...
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