Commit c6ed26fc authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

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).
parent 2fb541a6
...@@ -1003,6 +1003,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -1003,6 +1003,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
} while (have_to_wait); } 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 // Clear the output buffer
for (int a=0; a<nbAnt; a++) for (int a=0; a<nbAnt; a++)
memset(samplesVoid[a],0,sampleToByte(nsamps,1)); memset(samplesVoid[a],0,sampleToByte(nsamps,1));
...@@ -1092,6 +1097,17 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -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 *ptimestamp = t->nextRxTstamp; // return the time of the first sample
t->nextRxTstamp+=nsamps; t->nextRxTstamp+=nsamps;
LOG_D(HW, LOG_D(HW,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment