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
Michael Black
OpenXG-RAN
Commits
5a519297
Commit
5a519297
authored
Feb 07, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cpu measurements access from telnet server
parent
bbf4cc31
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
420 additions
and
311 deletions
+420
-311
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+15
-5
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
+182
-84
common/utils/telnetsrv/telnetsrv_measurements.h
common/utils/telnetsrv/telnetsrv_measurements.h
+88
-0
common/utils/telnetsrv/telnetsrv_measurments.h
common/utils/telnetsrv/telnetsrv_measurments.h
+0
-180
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 @
5a519297
...
@@ -501,21 +501,31 @@ int process_command(char *buf) {
...
@@ -501,21 +501,31 @@ int process_command(char *buf) {
}
/* strncmp: module name test */
}
/* strncmp: module name test */
else
if
(
strncasecmp
(
modulename
,
"loop"
,
4
)
==
0
)
{
else
if
(
strncasecmp
(
modulename
,
"loop"
,
4
)
==
0
)
{
int
f
=
fcntl
(
telnetparams
.
new_socket
,
F_GETFL
);
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
);
if
(
f
<
0
||
f1
<
0
)
{
client_printf
(
" Loop won't be cancelable: %s
\n
"
,
strerror
(
errno
)
);
}
for
(
int
lc
=
0
;
lc
<
telnetparams
.
loopcount
;
lc
++
)
{
for
(
int
lc
=
0
;
lc
<
telnetparams
.
loopcount
;
lc
++
)
{
char
dummybuff
[
20
];
char
dummybuff
[
20
];
char
tbuff
[
64
];
char
tbuff
[
64
];
int
rs
;
client_printf
(
CSI
"1J"
CSI
"1;10H "
STDFMT
"%s %i/%i
\n
"
,
client_printf
(
CSI
"1J"
CSI
"1;10H "
STDFMT
"%s %i/%i
\n
"
,
get_time
(
tbuff
,
sizeof
(
tbuff
)),
lc
,
telnetparams
.
loopcount
);
get_time
(
tbuff
,
sizeof
(
tbuff
)),
lc
,
telnetparams
.
loopcount
);
process_command
(
bufbck
+
strlen
(
"loop"
)
+
1
);
process_command
(
bufbck
+
strlen
(
"loop"
)
+
1
);
usleep
(
telnetparams
.
loopdelay
*
1000
)
;
errno
=
0
;
rs
=
read
(
telnetparams
.
new_socket
,
dummybuff
,
sizeof
(
dummybuff
));
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
;
break
;
}
}
usleep
(
telnetparams
.
loopdelay
*
1000
);
}
}
fcntl
(
telnetparams
.
new_socket
,
F_SETFL
,
f
);
fcntl
(
telnetparams
.
new_socket
,
F_SETFL
,
f
);
...
...
common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
0 → 100644
View file @
5a519297
/*
* 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
View file @
5a519297
This diff is collapsed.
Click to expand it.
common/utils/telnetsrv/telnetsrv_measurements.h
0 → 100644
View file @
5a519297
/*
* 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 */
common/utils/telnetsrv/telnetsrv_measurments.h
deleted
100644 → 0
View file @
bbf4cc31
/*
* 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_proccmd.h
* \brief: Include file defining telnet commands related to this linux process
* \author Francois TABURET
* \date 2017
* \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 LTEMAC_MEASURE \
{ \
{"total_num_bcch_pdu", &(macstatptr->total_num_bcch_pdu),TELNET_VARTYPE_INT32,0},\
{"bcch_buffer", &(macstatptr->bcch_buffer),TELNET_VARTYPE_INT32,0},\
{"total_bcch_buffer", &(macstatptr->total_bcch_buffer),TELNET_VARTYPE_INT32,0},\
{"bcch_mcs", &(macstatptr->bcch_mcs),TELNET_VARTYPE_INT32,0},\
{"total_num_ccch_pdu", &(macstatptr->total_num_ccch_pdu),TELNET_VARTYPE_INT32,0},\
{"ccch_buffer", &(macstatptr->ccch_buffer),TELNET_VARTYPE_INT32,0},\
{"total_ccch_buffer", &(macstatptr->total_ccch_buffer),TELNET_VARTYPE_INT32,0},\
{"ccch_mcs", &(macstatptr->ccch_mcs),TELNET_VARTYPE_INT32,0},\
{"total_num_pcch_pdu", &(macstatptr->total_num_pcch_pdu),TELNET_VARTYPE_INT32,0},\
{"pcch_buffer", &(macstatptr->pcch_buffer),TELNET_VARTYPE_INT32,0},\
{"total_pcch_buffer", &(macstatptr->total_pcch_buffer),TELNET_VARTYPE_INT32,0},\
{"pcch_mcs", &(macstatptr->pcch_mcs),TELNET_VARTYPE_INT32,0},\
{"num_dlactive_UEs", &(macstatptr->num_dlactive_UEs),TELNET_VARTYPE_INT16,0},\
{"available_prbs", &(macstatptr->available_prbs),TELNET_VARTYPE_INT16,0},\
{"total_available_prbs", &(macstatptr->total_available_prbs),TELNET_VARTYPE_INT32,0},\
{"available_ncces", &(macstatptr->available_ncces),TELNET_VARTYPE_INT16,0},\
{"dlsch_bitrate", &(macstatptr->dlsch_bitrate),TELNET_VARTYPE_INT32,0},\
{"dlsch_bytes_tx", &(macstatptr->dlsch_bytes_tx),TELNET_VARTYPE_INT32,0},\
{"dlsch_pdus_tx", &(macstatptr->dlsch_pdus_tx),TELNET_VARTYPE_INT32,0},\
{"total_dlsch_bitrate", &(macstatptr->total_dlsch_bitrate),TELNET_VARTYPE_INT32,0},\
{"total_dlsch_bytes_tx", &(macstatptr->total_dlsch_bytes_tx),TELNET_VARTYPE_INT32,0},\
{"total_dlsch_pdus_tx", &(macstatptr->total_dlsch_pdus_tx),TELNET_VARTYPE_INT32,0},\
{"ulsch_bitrate", &(macstatptr->ulsch_bitrate),TELNET_VARTYPE_INT32,0},\
{"ulsch_bytes_rx", &(macstatptr->ulsch_bytes_rx),TELNET_VARTYPE_INT32,0},\
{"ulsch_pdus_rx", &(macstatptr->ulsch_pdus_rx),TELNET_VARTYPE_INT32,0},\
{"total_ulsch_bitrate", &(macstatptr->total_ulsch_bitrate),TELNET_VARTYPE_INT32,0},\
{"total_ulsch_bytes_rx", &(macstatptr->total_ulsch_bytes_rx),TELNET_VARTYPE_INT32,0},\
{"total_ulsch_pdus_rx", &(macstatptr->total_ulsch_pdus_rx),TELNET_VARTYPE_INT32,0},\
{"sched_decisions", &(macstatptr->sched_decisions),TELNET_VARTYPE_INT32,0},\
{"missed_deadlines", &(macstatptr->missed_deadlines),TELNET_VARTYPE_INT32,0},\
}
#define LTEMAC_UEMEASURE \
{ \
{"dlsch_mcs1", &(macuestatptr->dlsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs2", &(macuestatptr->dlsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used", &(macuestatptr->rbs_used),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx", &(macuestatptr->rbs_used_retx),TELNET_VARTYPE_INT16,0},\
{"total_rbs_used", &(macuestatptr->total_rbs_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used", &(macuestatptr->ncce_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used_retx", &(macuestatptr->ncce_used_retx),TELNET_VARTYPE_INT16,0},\
{"TBS", &(macuestatptr->TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes", &(macuestatptr->total_pdu_bytes),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus", &(macuestatptr->total_num_pdus),TELNET_VARTYPE_INT32,0},\
{"overhead_bytes", &(macuestatptr->overhead_bytes),TELNET_VARTYPE_INT64,0},\
{"crnti", &(macuestatptr->crnti),TELNET_VARTYPE_INT16,0},\
{"normalized_rx_power", &(macuestatptr->normalized_rx_power),TELNET_VARTYPE_INT32,0},\
{"target_rx_power", &(macuestatptr->target_rx_power),TELNET_VARTYPE_INT32,0},\
{"ulsch_mcs1", &(macuestatptr->ulsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"ulsch_mcs2", &(macuestatptr->ulsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used_rx", &(macuestatptr->rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx_rx", &(macuestatptr->rbs_used_retx_rx),TELNET_VARTYPE_INT32,0},\
{"total_rbs_used_rx", &(macuestatptr->total_rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"ulsch_TBS", &(macuestatptr->ulsch_TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes_rx", &(macuestatptr->total_pdu_bytes_rx),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus_rx", &(macuestatptr->total_num_pdus_rx),TELNET_VARTYPE_INT32,0},\
{"num_errors_rx", &(macuestatptr->num_errors_rx),TELNET_VARTYPE_INT32,0},\
}
#define LTE_RLCMEASURE \
{ \
{"rlc_mode", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_pdcp_sdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_pdcp_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_pdcp_sdu_discarded", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_pdcp_bytes_discarded", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_data_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_data_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_retransmit_pdu_by_status", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_retransmit_bytes_by_status", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_retransmit_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_retransmit_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_control_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"tx_control_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_pdcp_sdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_pdcp_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_pdus_duplicate", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_bytes_duplicate", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_pdu_dropped", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_bytes_dropped", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_pdu_out_of_window", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_data_bytes_out_of_window", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_control_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
{"rx_control_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
{"timer_reorder_tout", NULL, TELNET_VARTYPE_UINT, 0},\
{"timer_poll_retrans_tout", NULL, TELNET_VARTYPE_UINT, 0},\
{"timer_status_prohibit_tout", NULL, TELNET_VARTYPE_UINT, 0},\
}
#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
);
telnetshell_cmddef_t
measur_cmdarray
[]
=
{
{
"show"
,
LTEMAC_MEASURGROUP_NAME
"|"
PHYCPU_MEASURGROUP_NAME
,
measurcmd_show
},
{
""
,
""
,
NULL
},
};
#else
extern
void
add_measur_cmds
(
void
);
#endif
/* TELNETSRV_MEASURCMD_MAIN */
openair1/PHY/TOOLS/time_meas.c
View file @
5a519297
...
@@ -29,7 +29,6 @@ int opp_enabled = 0;
...
@@ -29,7 +29,6 @@ int opp_enabled = 0;
double
get_cpu_freq_GHz
(
void
)
{
double
get_cpu_freq_GHz
(
void
)
{
time_stats_t
ts
=
{
0
};
time_stats_t
ts
=
{
0
};
reset_meas
(
&
ts
);
reset_meas
(
&
ts
);
ts
.
trials
++
;
ts
.
trials
++
;
...
@@ -38,32 +37,40 @@ double get_cpu_freq_GHz(void) {
...
@@ -38,32 +37,40 @@ double get_cpu_freq_GHz(void) {
ts
.
diff
=
(
rdtsc_oai
()
-
ts
.
in
);
ts
.
diff
=
(
rdtsc_oai
()
-
ts
.
in
);
cpu_freq_GHz
=
(
double
)
ts
.
diff
/
1000000000
;
cpu_freq_GHz
=
(
double
)
ts
.
diff
/
1000000000
;
printf
(
"CPU Freq is %f
\n
"
,
cpu_freq_GHz
);
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
)
{
if
(
opp_enabled
)
{
//static double cpu_freq_GHz = 3.2;
//static double cpu_freq_GHz = 3.2;
//if (cpu_freq_GHz == 0.0)
//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
)
{
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,"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
);
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
)
{
if
(
opp_enabled
)
{
static
int
first_time
=
0
;
static
int
first_time
=
0
;
static
double
cpu_freq_GHz
=
0
.
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
...
@@ -81,7 +88,6 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
if
(
ts
->
trials
>
0
)
{
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);
//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
))
{
if
((
total_exec_time
==
NULL
)
||
(
sf_exec_time
==
NULL
))
{
fprintf
(
stderr
,
"%25s: %15.3f us; %15d;
\n
"
,
fprintf
(
stderr
,
"%25s: %15.3f us; %15d;
\n
"
,
name
,
name
,
...
@@ -98,12 +104,9 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
...
@@ -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
;
static
double
cpu_freq_GHz
=
0
.
0
;
if
(
cpu_freq_GHz
==
0
.
0
)
if
(
cpu_freq_GHz
==
0
.
0
)
...
...
openair1/PHY/TOOLS/time_meas.h
View file @
5a519297
...
@@ -61,23 +61,21 @@ static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
...
@@ -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
));
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_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
(
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_time_meas_us
(
time_stats_t
*
ts
);
double
get_cpu_freq_GHz
(
void
);
double
get_cpu_freq_GHz
(
void
);
#if defined(__i386__)
#if defined(__i386__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
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
;
unsigned
long
long
int
x
;
__asm__
volatile
(
".byte 0x0f, 0x31"
:
"=A"
(
x
));
__asm__
volatile
(
".byte 0x0f, 0x31"
:
"=A"
(
x
));
return
x
;
return
x
;
}
}
#elif defined(__x86_64__)
#elif defined(__x86_64__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
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
;
unsigned
long
long
a
,
d
;
__asm__
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
__asm__
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
return
(
d
<<
32
)
|
a
;
return
(
d
<<
32
)
|
a
;
...
@@ -85,61 +83,54 @@ static inline unsigned long long rdtsc_oai(void)
...
@@ -85,61 +83,54 @@ static inline unsigned long long rdtsc_oai(void)
#elif defined(__arm__)
#elif defined(__arm__)
static
inline
uint32_t
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
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
;
uint32_t
r
=
0
;
asm
volatile
(
"mrc p15, 0, %0, c9, c13, 0"
:
"=r"
(
r
)
);
asm
volatile
(
"mrc p15, 0, %0, c9, c13, 0"
:
"=r"
(
r
)
);
return
r
;
return
r
;
}
}
#endif
#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
(
opp_enabled
)
{
if
(
ts
->
meas_flag
==
0
)
{
if
(
ts
->
meas_flag
==
0
)
{
ts
->
trials
++
;
ts
->
trials
++
;
ts
->
in
=
rdtsc_oai
();
ts
->
in
=
rdtsc_oai
();
ts
->
meas_flag
=
1
;
ts
->
meas_flag
=
1
;
}
}
else
{
else
{
ts
->
in
=
rdtsc_oai
();
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
)
{
if
(
opp_enabled
)
{
long
long
out
=
rdtsc_oai
();
long
long
out
=
rdtsc_oai
();
ts
->
diff
+=
(
out
-
ts
->
in
);
ts
->
diff
+=
(
out
-
ts
->
in
);
/// process duration is the difference between two clock points
/// process duration is the difference between two clock points
ts
->
p_time
=
(
out
-
ts
->
in
);
ts
->
p_time
=
(
out
-
ts
->
in
);
ts
->
diff_square
+=
(
out
-
ts
->
in
)
*
(
out
-
ts
->
in
);
ts
->
diff_square
+=
(
out
-
ts
->
in
)
*
(
out
-
ts
->
in
);
if
((
out
-
ts
->
in
)
>
ts
->
max
)
if
((
out
-
ts
->
in
)
>
ts
->
max
)
ts
->
max
=
out
-
ts
->
in
;
ts
->
max
=
out
-
ts
->
in
;
ts
->
meas_flag
=
0
;
ts
->
meas_flag
=
0
;
}
}
}
}
static
inline
void
reset_meas
(
time_stats_t
*
ts
)
{
static
inline
void
reset_meas
(
time_stats_t
*
ts
)
{
ts
->
trials
=
0
;
ts
->
trials
=
0
;
ts
->
diff
=
0
;
ts
->
diff
=
0
;
ts
->
p_time
=
0
;
ts
->
p_time
=
0
;
ts
->
diff_square
=
0
;
ts
->
diff_square
=
0
;
ts
->
max
=
0
;
ts
->
max
=
0
;
ts
->
meas_flag
=
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
)
{
if
(
opp_enabled
)
{
dst_ts
->
trials
=
src_ts
->
trials
;
dst_ts
->
trials
=
src_ts
->
trials
;
dst_ts
->
diff
=
src_ts
->
diff
;
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