Add a metric for rfsimulator channel emulator performance

Add a print and method to calculate rfsimulators channel emulation performance.
The counter unit is Megasample/second (Msps).
This commit is contained in:
Bartosz Podrygajlo
2025-02-19 16:18:16 +01:00
parent 2fb541a68e
commit c6ed26fca3
+16
View File
@@ -1003,6 +1003,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
} while (have_to_wait);
}
struct timespec start_time;
int ret = clock_gettime(CLOCK_REALTIME, &start_time);
AssertFatal(ret == 0, "clock_gettime() failed: errno %d, %s\n", errno, strerror(errno));
// Clear the output buffer
for (int a=0; a<nbAnt; a++)
memset(samplesVoid[a],0,sampleToByte(nsamps,1));
@@ -1092,6 +1097,17 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
}
struct timespec end_time;
ret = clock_gettime(CLOCK_REALTIME, &end_time);
AssertFatal(ret == 0, "clock_gettime() failed: errno %d, %s\n", errno, strerror(errno));
double diff_ns = (end_time.tv_sec - start_time.tv_sec) * 1000000000 + (end_time.tv_nsec - start_time.tv_nsec);
static double average = 0.0;
average = (average * 0.98) + ( nsamps / (diff_ns / 1e9) * 0.02);
static int calls = 0;
if (calls++ % 10000 == 0) {
LOG_D(HW, "Rfsimulator: velocity %.2f Msps, realtime requirements %.2f Msps\n", average / 1e6, t->sample_rate / 1e6);
}
*ptimestamp = t->nextRxTstamp; // return the time of the first sample
t->nextRxTstamp+=nsamps;
LOG_D(HW,