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:
Cedric Roux
2025-08-27 15:13:59 +02:00
committed by Robert Schmidt
parent fcd0013981
commit c8aea1b970
5 changed files with 76 additions and 76 deletions
+21 -21
View File
@@ -15,14 +15,14 @@ struct scrolltti {
int plot;
float refresh_rate;
pthread_mutex_t lock;
int subframes_per_frame;
int ticks_per_frame;
unsigned long *data;
unsigned long total; /* sum data[0..n] to have smoother value printed */
float *xout;
float *yout;
int insert_point;
int next_tick_frame;
int next_tick_subframe;
int next_tick_tick;
};
/* this array is used to get Y range 1000, 2000, 5000, 10000, ... */
@@ -41,21 +41,21 @@ static void *scrolltti_thread(void *_this)
/* TODO: optimize */
p = this->insert_point;
max = 0;
for (i = 0; i < this->subframes_per_frame * 100; i++) {
for (i = 0; i < this->ticks_per_frame * 100; i++) {
this->xout[i] = i;
this->yout[i] = this->data[p];
if (this->data[p] > max) max = this->data[p];
p = (p + 1) % (this->subframes_per_frame * 100);
p = (p + 1) % (this->ticks_per_frame * 100);
}
bps(o, this->total/(this->subframes_per_frame * 100.), "b/s");
bps(o, this->total/(this->ticks_per_frame * 100.), "b/s");
textarea_set_text(this->g, this->throughput_textarea, o);
/* for Y range we want 1000, 2000, 5000, 10000, 20000, 50000, etc. */
if (max < 1000) max = 1000;
mlog = pow(10, floor(log10(max)));
max = tolog[(int)ceil(max/mlog)] * mlog;
xy_plot_set_range(this->g, this->w, 0, this->subframes_per_frame * 100, 0, max);
xy_plot_set_range(this->g, this->w, 0, this->ticks_per_frame * 100, 0, max);
xy_plot_set_points(this->g, this->w, this->plot,
this->subframes_per_frame * 100, this->xout, this->yout);
this->ticks_per_frame * 100, this->xout, this->yout);
if (pthread_mutex_unlock(&this->lock)) abort();
sleepms(1000/this->refresh_rate);
}
@@ -73,35 +73,35 @@ static void insert(struct scrolltti *this, double value)
this->total -= this->data[this->insert_point];
this->data[this->insert_point] = value;
this->total += this->data[this->insert_point];
this->insert_point = (this->insert_point + 1) % (this->subframes_per_frame * 100);
this->insert_point = (this->insert_point + 1) % (this->ticks_per_frame * 100);
}
static void next_subframe(struct scrolltti *this)
static void next_tick(struct scrolltti *this)
{
this->next_tick_subframe++;
if (this->next_tick_subframe == this->subframes_per_frame) {
this->next_tick_subframe = 0;
this->next_tick_tick++;
if (this->next_tick_tick == this->ticks_per_frame) {
this->next_tick_tick = 0;
this->next_tick_frame++;
this->next_tick_frame %= 1024;
}
}
static void append(view *_this, int frame, int subframe, double value)
static void append(view *_this, int frame, int tick, double value)
{
struct scrolltti *this = (struct scrolltti *)_this;
if (pthread_mutex_lock(&this->lock)) abort();
while (this->next_tick_frame != frame || this->next_tick_subframe != subframe) {
while (this->next_tick_frame != frame || this->next_tick_tick != tick) {
insert(this, 0);
next_subframe(this);
next_tick(this);
}
insert(this, value);
next_subframe(this);
next_tick(this);
if (pthread_mutex_unlock(&this->lock)) abort();
}
view *new_view_scrolltti(float refresh_rate, gui *g, widget *w, int color,
widget *throughput_textarea, int subframes_per_frame)
widget *throughput_textarea, int ticks_per_frame)
{
struct scrolltti *ret = calloc(1, sizeof(struct scrolltti));
if (ret == NULL) abort();
@@ -115,12 +115,12 @@ view *new_view_scrolltti(float refresh_rate, gui *g, widget *w, int color,
ret->throughput_textarea = throughput_textarea;
ret->plot = xy_plot_new_plot(g, w, color);
ret->subframes_per_frame = subframes_per_frame;
ret->data = calloc(subframes_per_frame * 100, sizeof(unsigned long));
ret->ticks_per_frame = ticks_per_frame;
ret->data = calloc(ticks_per_frame * 100, sizeof(unsigned long));
if (ret->data == NULL) abort();
ret->xout = calloc(subframes_per_frame * 100, sizeof(float));
ret->xout = calloc(ticks_per_frame * 100, sizeof(float));
if (ret->xout == NULL) abort();
ret->yout = calloc(subframes_per_frame * 100, sizeof(float));
ret->yout = calloc(ticks_per_frame * 100, sizeof(float));
if (ret->yout == NULL) abort();
if (pthread_mutex_init(&ret->lock, NULL)) abort();
+16 -16
View File
@@ -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);
+2 -2
View File
@@ -18,9 +18,9 @@ view *new_view_textlist(int maxsize, float refresh_rate, gui *g, widget *w);
view *new_view_xy(int length, float refresh_rate, gui *g, widget *w,
int color, enum xy_mode mode);
view *new_view_tti(float refresh_rate, gui *g, widget *w, int color,
int subframes_per_frame);
int ticks_per_frame);
view *new_view_scrolltti(float refresh_rate, gui *g, widget *w,
int color, widget *throughput_label, int subframes_per_frame);
int color, widget *throughput_label, int ticks_per_frame);
view *new_view_time(int number_of_seconds, float refresh_rate,
gui *g, widget *w);
view *new_subview_time(view *time, int line, int color, int size);