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
promise
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
Expand all
Show 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
This diff is collapsed.
Click to expand it.
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
++
;
...
...
@@ -40,30 +39,38 @@ double get_cpu_freq_GHz(void) {
printf
(
"CPU Freq is %f
\n
"
,
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
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,35 +83,32 @@ 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
);
...
...
@@ -127,19 +122,15 @@ static inline void stop_meas(time_stats_t *ts)
}
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