T: replace 'subframe' by 'tick'
Some code in T tracers is used by both LTE and NR. In LTE, we expect 10 subframes per frame, and the logging is done with this assumption. We have one tick per subframe. In NR, we deal with slots, not subframes. And we have n ticks per frame (depending on mu). As of today, only n=20 is tested (corresponding to mu=1). A previous commit introduced 'subframes_per_frame' which had the correct meaning for LTE but was truly 'slots per frame' for NR. This creates confusion. Let's replace 'subframe' by 'tick' to reduce confusion.
This commit is contained in:
committed by
Robert Schmidt
parent
fcd0013981
commit
c8aea1b970
@@ -21,20 +21,20 @@ struct tti {
|
||||
float *xout;
|
||||
float *yout;
|
||||
int last_insert_point;
|
||||
int subframes_per_frame;
|
||||
int ticks_per_frame;
|
||||
};
|
||||
|
||||
static int far_enough(int i, int last_insert, int plot_width,
|
||||
int subframes_per_frame)
|
||||
int ticks_per_frame)
|
||||
{
|
||||
int p1;
|
||||
int p2;
|
||||
int hole_size_px;
|
||||
int hole_size_tti;
|
||||
hole_size_px = 10;
|
||||
hole_size_tti = 1024 * subframes_per_frame * hole_size_px / plot_width;
|
||||
hole_size_tti = 1024 * ticks_per_frame * hole_size_px / plot_width;
|
||||
p1 = last_insert;
|
||||
p2 = (last_insert + hole_size_tti) % (1024 * subframes_per_frame);
|
||||
p2 = (last_insert + hole_size_tti) % (1024 * ticks_per_frame);
|
||||
if (p1 < p2) {
|
||||
return !(i > p1 && i < p2);
|
||||
}
|
||||
@@ -55,11 +55,11 @@ static void *tti_thread(void *_this)
|
||||
length = 0;
|
||||
double max = 0;
|
||||
/* TODO: optimize */
|
||||
for (i = 0; i < 1024 * this->subframes_per_frame; i++)
|
||||
for (i = 0; i < 1024 * this->ticks_per_frame; i++)
|
||||
/* do not take points too close after last insertion point */
|
||||
if (this->valid[i] &&
|
||||
far_enough(i, this->last_insert_point, plot_width,
|
||||
this->subframes_per_frame)) {
|
||||
this->ticks_per_frame)) {
|
||||
this->xout[length] = i;
|
||||
this->yout[length] = this->data[i];
|
||||
if (this->data[i] > max) max = this->data[i];
|
||||
@@ -92,11 +92,11 @@ static void clear(view *this)
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void append(view *_this, int frame, int subframe, double value)
|
||||
static void append(view *_this, int frame, int tick, double value)
|
||||
{
|
||||
struct tti *this = (struct tti *)_this;
|
||||
int i;
|
||||
int index = frame * this->subframes_per_frame + subframe;
|
||||
int index = frame * this->ticks_per_frame + tick;
|
||||
|
||||
if (pthread_mutex_lock(&this->lock)) abort();
|
||||
|
||||
@@ -105,10 +105,10 @@ static void append(view *_this, int frame, int subframe, double value)
|
||||
* this may be wrong if delay between two append is
|
||||
* greater than 1024 frames (something like that)
|
||||
*/
|
||||
i = (this->last_insert_point + 1) % (1024 * this->subframes_per_frame);
|
||||
i = (this->last_insert_point + 1) % (1024 * this->ticks_per_frame);
|
||||
while (i != index) {
|
||||
this->valid[i] = 0;
|
||||
i = (i + 1) % (1024 * this->subframes_per_frame);
|
||||
i = (i + 1) % (1024 * this->ticks_per_frame);
|
||||
}
|
||||
|
||||
this->data[index] = value;
|
||||
@@ -120,7 +120,7 @@ static void append(view *_this, int frame, int subframe, double value)
|
||||
}
|
||||
|
||||
view *new_view_tti(float refresh_rate, gui *g, widget *w, int color,
|
||||
int subframes_per_frame)
|
||||
int ticks_per_frame)
|
||||
{
|
||||
struct tti *ret = calloc(1, sizeof(struct tti));
|
||||
if (ret == NULL) abort();
|
||||
@@ -137,14 +137,14 @@ view *new_view_tti(float refresh_rate, gui *g, widget *w, int color,
|
||||
|
||||
if (pthread_mutex_init(&ret->lock, NULL)) abort();
|
||||
|
||||
ret->subframes_per_frame = subframes_per_frame;
|
||||
ret->data = calloc(subframes_per_frame * 1024, sizeof(float));
|
||||
ret->ticks_per_frame = ticks_per_frame;
|
||||
ret->data = calloc(ticks_per_frame * 1024, sizeof(float));
|
||||
if (ret->data == NULL) abort();
|
||||
ret->valid = calloc(subframes_per_frame * 1024, sizeof(int));
|
||||
ret->valid = calloc(ticks_per_frame * 1024, sizeof(int));
|
||||
if (ret->valid == NULL) abort();
|
||||
ret->xout = calloc(subframes_per_frame * 1024, sizeof(float));
|
||||
ret->xout = calloc(ticks_per_frame * 1024, sizeof(float));
|
||||
if (ret->xout == NULL) abort();
|
||||
ret->yout = calloc(subframes_per_frame * 1024, sizeof(float));
|
||||
ret->yout = calloc(ticks_per_frame * 1024, sizeof(float));
|
||||
if (ret->yout == NULL) abort();
|
||||
|
||||
new_thread(tti_thread, ret);
|
||||
|
||||
Reference in New Issue
Block a user