Commit ad0ca852 authored by Cedric Roux's avatar Cedric Roux
Browse files

- Added per-slot based interrupt for accurate computation of stats

Every 500us an interrupt is raised
-> Option -o to enable this feature

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4108 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 23e9d2a2
......@@ -552,6 +552,8 @@ int
sinr_dB=-20;
}
init_slot_isr();
t = clock();
for (frame=0; frame<oai_emulation.info.n_frames; frame++) {
......@@ -606,6 +608,8 @@ int
for (slot=0 ; slot<20 ; slot++) {
wait_for_slot_isr();
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
......
......@@ -327,6 +327,9 @@ void init_oai_emulation() {
oai_emulation.info.cli_num_enb= NUMBER_OF_eNB_MAX;
oai_emulation.info.cli_num_ue= NUMBER_OF_UE_MAX;
oai_emulation.info.slot_isr = 0;
oai_emulation.info.slot_sfd = -1;
//for (i=0; i < oai_emulation.info.cli_num_enb; i++)
for (i=0; i < NUMBER_OF_eNB_MAX; i++)
......
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <execinfo.h>
#include <time.h>
#include <sys/timerfd.h>
#include "oaisim_functions.h"
......@@ -102,7 +109,7 @@ void get_simulation_options(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:k:l:m:M:n:N:O:p:P:rR:s:S:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) {
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:k:l:m:M:n:N:oO:p:P:rR:s:S:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) {
switch (c) {
case 0:
......@@ -347,6 +354,9 @@ void get_simulation_options(int argc, char *argv[]) {
printf("You enabled MME mode without MME support...\n");
#endif
break;
case 'o':
oai_emulation.info.slot_isr = 1;
break;
default:
help ();
exit (-1);
......@@ -853,6 +863,49 @@ void update_otg_UE(int module_id, unsigned int ctime) {
#endif
}
int init_slot_isr(void)
{
if (oai_emulation.info.slot_isr) {
struct itimerspec its;
int sfd;
sfd = timerfd_create(CLOCK_REALTIME, 0);
if (sfd == -1) {
LOG_E(EMU, "Failed in timerfd_create (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
/* Start the timer */
its.it_value.tv_sec = 0;
its.it_value.tv_nsec = 500 * 1000;
its.it_interval.tv_sec = its.it_value.tv_sec;
its.it_interval.tv_nsec = its.it_value.tv_nsec;
if (timerfd_settime(sfd, TFD_TIMER_ABSTIME, &its, NULL) == -1) {
LOG_E(EMU, "Failed in timer_settime (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
oai_emulation.info.slot_sfd = sfd;
}
}
void wait_for_slot_isr(void)
{
uint64_t exp;
ssize_t res;
if (oai_emulation.info.slot_sfd > 0) {
res = read(oai_emulation.info.slot_sfd, &exp, sizeof(exp));
if ((res < 0) || (res != sizeof(exp))) {
LOG_E(EMU, "Failed in read (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
}
}
void exit_fun(const char* s)
{
void *array[10];
......
......@@ -5,6 +5,9 @@
#include "UTIL/FIFO/pad_list.h"
#ifndef OAISIM_FUNCTIONS_H_
#define OAISIM_FUNCTIONS_H_
void get_simulation_options(int argc, char *argv[]);
void check_and_adjust_params();
......@@ -35,3 +38,8 @@ void exit_fun(const char* s);
void init_pad();
int init_slot_isr(void);
void wait_for_slot_isr(void);
#endif /* OAISIM_FUNCTIONS_H_ */
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