mirror of https://github.com/PentHertz/srsLTE.git
Added MAC execution time traces. Increased preamble length to 0.4 ms
This commit is contained in:
parent
083cd89058
commit
f2b1a193df
|
@ -1,4 +1,4 @@
|
||||||
function [ tti, values ] = read_trace_uint( filename, count )
|
function [ values, tti] = read_trace_uint( filename, count )
|
||||||
|
|
||||||
[tidin msg]=fopen(filename,'r');
|
[tidin msg]=fopen(filename,'r');
|
||||||
if (tidin==-1)
|
if (tidin==-1)
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
if (st >= nof_elems) {
|
if (st >= nof_elems) {
|
||||||
st=0;
|
st=0;
|
||||||
}
|
}
|
||||||
} while(st<rpm);
|
} while(st!=rpm);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace srslte {
|
||||||
void *uhd;
|
void *uhd;
|
||||||
|
|
||||||
static const double lo_offset = 8e6; // LO offset (in Hz)
|
static const double lo_offset = 8e6; // LO offset (in Hz)
|
||||||
static const double burst_settle_time = 0.3e-3; // Start of burst settle time (off->on RF transition time)
|
static const double burst_settle_time = 0.4e-3; // Start of burst settle time (off->on RF transition time)
|
||||||
const static uint32_t burst_settle_max_samples = 30720000; // 30.72 MHz is maximum frequency
|
const static uint32_t burst_settle_max_samples = 30720000; // 30.72 MHz is maximum frequency
|
||||||
|
|
||||||
srslte_timestamp_t end_of_burst_time;
|
srslte_timestamp_t end_of_burst_time;
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef _Complex float cf_t;
|
||||||
class mac : public timer_callback
|
class mac : public timer_callback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
mac() : timers_db((uint32_t) NOF_MAC_TIMERS), tr_end_time(1024*10), tr_start_time(1024*10) {started=false; pcap = NULL; }
|
mac() : timers_db((uint32_t) NOF_MAC_TIMERS), tr_exec_total(1024*10), tr_exec_dl(1024*10), tr_exec_ul(1024*10) {started=false; pcap = NULL; }
|
||||||
bool init(phy *phy_h, tti_sync *ttisync, log *log_h);
|
bool init(phy *phy_h, tti_sync *ttisync, log *log_h);
|
||||||
void stop();
|
void stop();
|
||||||
int get_tti();
|
int get_tti();
|
||||||
|
@ -156,12 +156,18 @@ private:
|
||||||
mac_pcap* pcap;
|
mac_pcap* pcap;
|
||||||
|
|
||||||
// Variables for Execution time Trace
|
// Variables for Execution time Trace
|
||||||
trace<uint32_t> tr_start_time;
|
trace<uint32_t> tr_exec_total;
|
||||||
trace<uint32_t> tr_end_time;
|
trace<uint32_t> tr_exec_dl;
|
||||||
|
trace<uint32_t> tr_exec_ul;
|
||||||
|
struct timeval tr_time_total[3];
|
||||||
|
struct timeval tr_time_ul[3];
|
||||||
|
struct timeval tr_time_dl[3];
|
||||||
bool tr_enabled;
|
bool tr_enabled;
|
||||||
bool is_first_of_burst;
|
bool is_first_of_burst;
|
||||||
void tr_log_start(uint32_t tti);
|
void tr_log_start(uint32_t tti);
|
||||||
void tr_log_end(uint32_t tti);
|
void tr_log_end(uint32_t tti);
|
||||||
|
void tr_log_dl(uint32_t tti);
|
||||||
|
void tr_log_ul(uint32_t tti);
|
||||||
void set_phy_crnti(uint16_t phy_rnti);
|
void set_phy_crnti(uint16_t phy_rnti);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,21 +96,49 @@ void mac::start_trace()
|
||||||
|
|
||||||
void mac::write_trace(std::string filename)
|
void mac::write_trace(std::string filename)
|
||||||
{
|
{
|
||||||
tr_start_time.writeToBinary(filename + ".start");
|
tr_exec_total.writeToBinary(filename + ".total");
|
||||||
tr_end_time.writeToBinary(filename + ".end");
|
tr_exec_dl.writeToBinary(filename + ".dl");
|
||||||
|
tr_exec_ul.writeToBinary(filename + ".ul");
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac::tr_log_start(uint32_t tti)
|
void mac::tr_log_start(uint32_t tti)
|
||||||
{
|
{
|
||||||
if (tr_enabled) {
|
if (tr_enabled) {
|
||||||
tr_start_time.push_cur_time_us(tti);
|
gettimeofday(&tr_time_total[1], NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac::tr_log_end(uint32_t tti)
|
void mac::tr_log_end(uint32_t tti)
|
||||||
{
|
{
|
||||||
if (tr_enabled) {
|
if (tr_enabled) {
|
||||||
tr_end_time.push_cur_time_us(tti);
|
/* compute total execution time */
|
||||||
|
gettimeofday(&tr_time_total[2], NULL);
|
||||||
|
get_time_interval(tr_time_total);
|
||||||
|
tr_exec_total.push(tti, tr_time_total[0].tv_usec);
|
||||||
|
|
||||||
|
/* ul execution time is from the call to tr_log_ul */
|
||||||
|
memcpy(&tr_time_ul[2], &tr_time_total[2], sizeof(struct timeval));
|
||||||
|
get_time_interval(tr_time_ul);
|
||||||
|
tr_exec_ul.push(tti, tr_time_ul[0].tv_usec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mac::tr_log_ul(uint32_t tti)
|
||||||
|
{
|
||||||
|
if (tr_enabled) {
|
||||||
|
/* DL execution time is from the call to tr_log_dl to the call to tr_log_ul */
|
||||||
|
gettimeofday(&tr_time_dl[2], NULL);
|
||||||
|
get_time_interval(tr_time_dl);
|
||||||
|
tr_exec_dl.push(tti, tr_time_dl[0].tv_usec);
|
||||||
|
|
||||||
|
memcpy(&tr_time_ul[1], &tr_time_dl[2], sizeof(struct timeval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mac::tr_log_dl(uint32_t tti)
|
||||||
|
{
|
||||||
|
if (tr_enabled) {
|
||||||
|
gettimeofday(&tr_time_dl[1], NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +232,6 @@ void mac::main_radio_loop() {
|
||||||
}
|
}
|
||||||
if (is_synchronized) {
|
if (is_synchronized) {
|
||||||
/* Warning: Here order of invocation of procedures is important!! */
|
/* Warning: Here order of invocation of procedures is important!! */
|
||||||
tr_log_end(tti);
|
|
||||||
tti = ttisync->wait();
|
tti = ttisync->wait();
|
||||||
tr_log_start(tti);
|
tr_log_start(tti);
|
||||||
log_h->step(tti);
|
log_h->step(tti);
|
||||||
|
@ -236,6 +263,8 @@ void mac::main_radio_loop() {
|
||||||
// Receive PCH, if requested
|
// Receive PCH, if requested
|
||||||
receive_pch(tti);
|
receive_pch(tti);
|
||||||
|
|
||||||
|
tr_log_dl(tti);
|
||||||
|
|
||||||
// Process DL grants always
|
// Process DL grants always
|
||||||
process_dl_grants(tti);
|
process_dl_grants(tti);
|
||||||
|
|
||||||
|
@ -247,6 +276,8 @@ void mac::main_radio_loop() {
|
||||||
dl_harq.send_pending_ack_contention_resolution();
|
dl_harq.send_pending_ack_contention_resolution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_log_ul(tti);
|
||||||
|
|
||||||
// Process UL grants if RA procedure is done and we have pending data or in contention resolution
|
// Process UL grants if RA procedure is done and we have pending data or in contention resolution
|
||||||
if (ra_procedure.is_contention_resolution() || ra_procedure.is_successful()) {
|
if (ra_procedure.is_contention_resolution() || ra_procedure.is_successful()) {
|
||||||
|
@ -279,6 +310,8 @@ void mac::main_radio_loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_log_end(tti);
|
||||||
|
|
||||||
timers_db.step_all();
|
timers_db.step_all();
|
||||||
|
|
||||||
// Check if there is pending CCCH SDU in Multiplexing Unit
|
// Check if there is pending CCCH SDU in Multiplexing Unit
|
||||||
|
|
Loading…
Reference in New Issue