diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index d1807080bcc1b5f370b91d5cd0c76759f0bacfd5..85441722b0ecd78f72fffcedf04b9be67451b829 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -1938,3 +1938,82 @@ ID = VCD_FUNCTION_RECV_IF5
     DESC = VCD function RECV_IF5
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
+
+#################
+#### UE LOGS ####
+#################
+#general logs
+ID = UE_MASTER_TICK
+    DESC = UE master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view
+    GROUP = ALL:GENERAL:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe
+
+#PHY logs
+ID = UE_PHY_UL_TICK
+    DESC = UE uplink tick - one tick per ms at start of uplink processing
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe
+ID = UE_PHY_DL_TICK
+    DESC = UE downlink tick - one tick per ms at start of downlink processing
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe
+ID = UE_PHY_DLSCH_UE_DCI
+    DESC = UE downlink UE specific DCI as sent by the PHY layer
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
+ID = UE_PHY_DLSCH_UE_ACK
+    DESC = UE downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
+ID = UE_PHY_DLSCH_UE_NACK
+    DESC = UE downlink UE NACK as seen by the PHY layer in process_HARQ_feedback
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
+ID = UE_PHY_ULSCH_UE_DCI
+    DESC = UE uplink UE specific DCI as sent by the PHY layer
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS
+ID = UE_PHY_ULSCH_UE_ACK
+    DESC = UE uplink UE ACK as seen by the PHY layer
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
+ID = UE_PHY_ULSCH_UE_NACK
+    DESC = UE uplink UE NACK as seen by the PHY layer
+    GROUP = ALL:PHY:GRAPHIC:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
+ID = UE_PHY_INPUT_SIGNAL
+    DESC = UE received signal in the time domain for a duration of 1ms
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,rxdata
+ID = UE_PHY_DL_CHANNEL_ESTIMATE
+    DESC = UE channel estimation in the time domain
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
+ID = UE_PHY_PDCCH_IQ
+    DESC = UE PDCCH received IQ data
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,nb_rb : int,NB_RB_DL : int,symbols_per_tti : buffer,rxdataF_comp
+ID = UE_PHY_PDCCH_ENERGY
+    DESC = UE PDSCH 1 energy and threshold
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdcch_ch_level00 : int,pdcch_ch_level01 : int,pdcch_ch_level10: int,pdcch_ch_level11
+ID = UE_PHY_PDSCH_IQ
+    DESC = UE PDSCH received IQ data
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
+ID = UE_PHY_PDSCH_ENERGY
+    DESC = UE PDSCH 1 energy and threshold
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdsch_ch_level00 : int,pdsch_ch_level01 : int,pdsch_ch_level10: int,pdsch_ch_level11
+ID = UE_PHY_PUSCH_TX_POWER
+    DESC = UE PUSCH  tx power
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pusch : int,ampl: int,g_pusch: int,pl: int,nb_rb
+ID = UE_PHY_PUCCH_TX_POWER
+    DESC = UE PDSCH 1 energy and threshold
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pucch : int,ampl: int,g_pucch: int,pl
+ID = UE_PHY_MEAS
+    DESC = UE PHY measurements
+    GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
+    FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,rsrp : int,rssi : int,snr: int,rx_power: int,noise_power: int,w_cqi: int,freq_offset
diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile
index 71f1d25f9251b375dd5f57d88b59d78f979b3b11..f6c65f64000e6da238d14d843d1fe36e8325eda2 100644
--- a/common/utils/T/tracer/Makefile
+++ b/common/utils/T/tracer/Makefile
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
 
 LIBS=-lX11 -lm -lpng -lXft
 
-all: record replay extract_config textlog enb vcd macpdu2wireshark
+all: record replay extract_config textlog enb ue vcd macpdu2wireshark
 
 record: utils.o record.o database.o config.o
 	$(CC) $(CFLAGS) -o record $^ $(LIBS)
@@ -26,6 +26,11 @@ enb: utils.o enb.o database.o event.o handler.o config.o \
          filter/filter.a
 	$(CC) $(CFLAGS) -o enb $^ $(LIBS)
 
+ue: utils.o ue.o database.o event.o handler.o config.o \
+         event_selector.o view/view.a gui/gui.a logger/logger.a \
+         filter/filter.a
+	$(CC) $(CFLAGS) -o ue $^ $(LIBS)
+
 vcd: utils.o vcd.o database.o event.o handler.o config.o \
          event_selector.o view/view.a gui/gui.a logger/logger.a \
          filter/filter.a
diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..5709a4e79e06c82f2baa3a90b8cea683c768471c
--- /dev/null
+++ b/common/utils/T/tracer/ue.c
@@ -0,0 +1,876 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <signal.h>
+#include "database.h"
+#include "event.h"
+#include "handler.h"
+#include "logger/logger.h"
+#include "view/view.h"
+#include "gui/gui.h"
+#include "filter/filter.h"
+#include "utils.h"
+#include "../T_defs.h"
+#include "event_selector.h"
+#include "openair_logo.h"
+#include "config.h"
+
+typedef struct {
+  view *phyview;
+  view *macview;
+  view *rlcview;
+  view *pdcpview;
+  view *rrcview;
+  view *legacy;
+  widget *current_ue_label;
+  widget *prev_ue_button;
+  widget *next_ue_button;
+  widget *pdsch_iq_ue_xy_plot;
+  widget *dl_estimate_ue_xy_plot;
+  widget *pdcch_energy_ue_xy_plot;
+  widget *pdsch_energy_ue_xy_plot;
+  widget *pdcch_iq_ue_xy_plot;
+  widget *dl_ul_harq_ue_label;
+  widget *dl_mcs_xy_plot;
+  widget *ul_mcs_xy_plot;
+  widget *pusch_power_xy_plot;
+  widget *pucch_power_xy_plot;
+  widget *phy_meas_xy_plot;
+  logger *pdsch_iq_ue_logger;
+  logger *dl_estimate_ue_logger;
+  logger *pdcch_iq_ue_logger;
+  logger *dl_dci_logger[8];
+  logger *dl_ack_logger[8];
+  logger *dl_nack_logger[8];
+  logger *ul_dci_logger[8];
+  logger *ul_dci_retransmission_logger[8];
+  logger *ul_ack_logger[8];
+  logger *ul_nack_logger[8];
+  logger *dl_mcs_logger;
+  logger *ul_mcs_logger;
+  logger *pusch_power_logger;
+  logger *pusch_ampl_logger;
+  logger *pucch_power_logger;
+  logger *pucch_ampl_logger;
+  logger *pdcch_energy_logger;
+  logger *pdsch_energy_logger;
+  logger *phy_meas_logger;
+} ue_gui;
+
+typedef struct {
+  int socket;
+  int *is_on;
+  int nevents;
+  pthread_mutex_t lock;
+  ue_gui *e;
+  int ue;                /* what UE is displayed in the UE specific views */
+  void *database;
+} ue_data;
+
+void is_on_changed(void *_d)
+{
+  ue_data *d = _d;
+  char t;
+
+  if (pthread_mutex_lock(&d->lock)) abort();
+
+  if (d->socket == -1) goto no_connection;
+
+  t = 1;
+  if (socket_send(d->socket, &t, 1) == -1 ||
+      socket_send(d->socket, &d->nevents, sizeof(int)) == -1 ||
+      socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1)
+    goto connection_dies;
+
+no_connection:
+  if (pthread_mutex_unlock(&d->lock)) abort();
+  return;
+
+connection_dies:
+  close(d->socket);
+  d->socket = -1;
+  if (pthread_mutex_unlock(&d->lock)) abort();
+}
+
+void usage(void)
+{
+  printf(
+"options:\n"
+"    -d <database file>        this option is mandatory\n"
+"    -on <GROUP or ID>         turn log ON for given GROUP or ID\n"
+"    -off <GROUP or ID>        turn log OFF for given GROUP or ID\n"
+"    -ON                       turn all logs ON\n"
+"    -OFF                      turn all logs OFF\n"
+"                              note: you may pass several -on/-off/-ON/-OFF,\n"
+"                                    they will be processed in order\n"
+"                                    by default, all is off\n"
+"    -ip <host>                connect to given IP address (default %s)\n"
+"    -p <port>                 connect to given port (default %d)\n"
+"    -debug-gui                activate GUI debug logs\n",
+  DEFAULT_REMOTE_IP,
+  DEFAULT_REMOTE_PORT
+  );
+  exit(1);
+}
+
+static void *gui_thread(void *_g)
+{
+  gui *g = _g;
+  gui_loop(g);
+  return NULL;
+}
+
+static filter *ticktime_filter(void *database, char *event, int i, int ue)
+{
+  /* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */
+  return
+    filter_and(
+      filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)),
+      filter_and(
+        filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)),
+        filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0))));
+}
+
+static void set_current_ue(gui *g, ue_data *e, int ue)
+{
+  int i;
+  char s[256];
+
+  sprintf(s, "[UE %d]  ", ue);
+  label_set_text(g, e->e->current_ue_label, s);
+  sprintf(s, "PDSCH IQ [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pdsch_iq_ue_xy_plot, s);
+  sprintf(s, "DL estimated channel [UE %d]", ue);
+  xy_plot_set_title(g, e->e->dl_estimate_ue_xy_plot, s);
+  sprintf(s, "PDCCH energy [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pdcch_energy_ue_xy_plot, s);
+  sprintf(s, "PDSCH energy [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pdsch_energy_ue_xy_plot, s);
+  sprintf(s, "PDCCH IQ [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pdcch_iq_ue_xy_plot, s);
+  sprintf(s, "DL/UL HARQ (x8) [UE %d]", ue);
+  label_set_text(g, e->e->dl_ul_harq_ue_label, s);
+  sprintf(s, "DL MCS [UE %d]", ue);
+  xy_plot_set_title(g, e->e->dl_mcs_xy_plot, s);
+  sprintf(s, "UL MCS [UE %d]", ue);
+  xy_plot_set_title(g, e->e->ul_mcs_xy_plot, s);
+  sprintf(s, "PUSCH POWER [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pusch_power_xy_plot, s);
+  sprintf(s, "PUCCH POWER [UE %d]", ue);
+  xy_plot_set_title(g, e->e->pucch_power_xy_plot, s);
+  sprintf(s, "PHY Measurements [UE %d]", ue);
+  xy_plot_set_title(g, e->e->phy_meas_xy_plot, s);
+  
+  logger_set_filter(e->e->pdsch_iq_ue_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PDSCH_IQ", "UE_ID"),
+        filter_int(ue)));
+  logger_set_filter(e->e->dl_estimate_ue_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_DL_CHANNEL_ESTIMATE", "UE_ID"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pdcch_energy_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PDCCH_ENERGY", "UE_ID"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pdsch_energy_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PDSCH_ENERGY", "UE_ID"),
+        filter_int(ue)));
+  logger_set_filter(e->e->phy_meas_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_MEAS", "UE_ID"),
+        filter_int(ue)));  
+  /*logger_set_filter(e->pucch1_energy_ue_energy_logger,
+      filter_eq(
+        filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
+        filter_int(ue)));*/
+  /*logger_set_filter(e->e->pdcch_iq_ue_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PDCCH_IQ", "UE_ID"),
+        filter_int(ue)));*/
+  for (i = 0; i < 8; i++) {
+    logger_set_filter(e->e->dl_dci_logger[i],
+        ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i, ue));
+    logger_set_filter(e->e->dl_ack_logger[i],
+        ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i, ue));
+    logger_set_filter(e->e->dl_nack_logger[i],
+        ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i, ue));
+    logger_set_filter(e->e->ul_dci_logger[i],
+        ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i, ue));
+    /*logger_set_filter(e->ul_dci_retransmission_logger[i],
+        ticktime_filter(e->database,
+            "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i, ue));*/
+    logger_set_filter(e->e->ul_ack_logger[i],
+        ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i, ue));
+    logger_set_filter(e->e->ul_nack_logger[i],
+        ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i, ue));
+  }
+  logger_set_filter(e->e->dl_mcs_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_DLSCH_UE_DCI", "UE_id"),
+        filter_int(ue)));
+  logger_set_filter(e->e->ul_mcs_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_ULSCH_UE_DCI", "UE_id"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pusch_power_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pusch_ampl_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pucch_power_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
+        filter_int(ue)));
+  logger_set_filter(e->e->pucch_ampl_logger,
+      filter_eq(
+        filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
+        filter_int(ue)));
+}
+
+static void click(void *private, gui *g,
+    char *notification, widget *w, void *notification_data)
+{
+  int *d = notification_data;
+  int button = d[0];
+  ue_data *ed = private;
+  ue_gui *e = ed->e;
+  int ue = ed->ue;
+
+  if (button != 1) return;
+  if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
+  if (w == e->next_ue_button) ue++;
+
+  if (pthread_mutex_lock(&ed->lock)) abort();
+  if (ue != ed->ue) {
+    set_current_ue(g, ed, ue);
+    ed->ue = ue;
+  }
+  if (pthread_mutex_unlock(&ed->lock)) abort();
+}
+
+static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
+    ue_data *ed)
+{
+  widget *main_window;
+  widget *top_container;
+  widget *line, *col;
+  widget *logo;
+  widget *input_signal_plot;
+  logger *input_signal_log;
+  view *input_signal_view;
+  widget *timeline_plot;
+  logger *timelog;
+  view *timeview;
+  view *subview;
+  widget *text;
+  view *textview;
+  int i;
+  widget *w, *w2;
+  view *v;
+  logger *l;
+
+  main_window = new_toplevel_window(g, 1200, 900, "eNB tracer");
+  top_container = new_container(g, VERTICAL);
+  widget_add_child(g, main_window, top_container, -1);
+
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  logo = new_image(g, openair_logo_png, openair_logo_png_len);
+
+  /* logo + prev/next UE buttons */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, col, logo, -1);
+  w = new_container(g, HORIZONTAL);
+  widget_add_child(g, col, w, -1);
+  w2 = new_label(g, "");
+  widget_add_child(g, w, w2, -1);
+  e->current_ue_label = w2;
+  /* TODO: use button widget, not label widget */
+  w2 = new_label(g, "  [prev UE]  ");
+  widget_add_child(g, w, w2, -1);
+  label_set_clickable(g, w2, 1);
+  e->prev_ue_button = w2;
+  w2 = new_label(g, "  [next UE]  ");
+  widget_add_child(g, w, w2, -1);
+  label_set_clickable(g, w2, 1);
+  e->next_ue_button = w2;
+  widget_add_child(g, line, col, -1);
+
+  input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20);
+  widget_add_child(g, line, input_signal_plot, -1);
+  xy_plot_set_range(g, input_signal_plot, 0, 7680*10, 20, 70);
+  input_signal_log = new_framelog(h, database,
+      "UE_PHY_INPUT_SIGNAL", "subframe", "rxdata");
+  /* a skip value of 10 means to process 1 frame over 10, that is
+   * more or less 10 frames per second
+   */
+  framelog_set_skip(input_signal_log, 10);
+  input_signal_view = new_view_xy(7680*10, 10,
+      g, input_signal_plot, new_color(g, "#0c0c72"), XY_LOOP_MODE);
+  logger_add_view(input_signal_log, input_signal_view);
+
+  /* UE x PDSCH IQ data */
+  w = new_xy_plot(g, 55, 55, "", 50);
+  e->pdsch_iq_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, -500, 500, -500, 500);
+  l = new_iqlog(h, database, "UE_PHY_PDSCH_IQ", "nb_rb",
+      "N_RB_UL", "symbols_per_tti", "pusch_comp");
+  v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
+  logger_add_view(l, v);
+  e->pdsch_iq_ue_logger = l;
+
+  /* UE x estimated DL channel */
+  w = new_xy_plot(g, 280, 55, "", 50);
+  e->dl_estimate_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 512*10, -10, 80);
+  l = new_framelog(h, database,
+      "UE_PHY_DL_CHANNEL_ESTIMATE", "subframe", "chest_t");
+  //framelog_set_skip(input_signal_log, 10);
+  framelog_set_update_only_at_sf9(l, 0);
+  v = new_view_xy(512*10, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE);
+  logger_add_view(l, v);
+  e->dl_estimate_ue_logger = l;
+
+  /* PHY Meas */
+  w = new_xy_plot(g, 128, 55, "", 50);
+  e->phy_meas_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 1024*10, -130, 35);
+  /*l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "rssi", 0, -1);
+  v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
+  logger_add_view(l, v);
+  e->phy_meas_logger = l;*/
+  l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "rsrp", 0, -1);
+  v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
+  logger_add_view(l, v);
+  e->phy_meas_logger = l;
+  l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "snr", 0, -1);
+  v = new_view_tti(10, g, w, new_color(g, "#0c720c"));
+  logger_add_view(l, v);
+  e->phy_meas_logger = l;
+    
+  /* UE x PDSCH energy */
+  w = new_xy_plot(g, 128, 55, "", 50);
+  e->pdsch_energy_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+  l = new_ttilog(h, database,
+      "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+  logger_add_view(l, v);
+  e->pdsch_energy_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+  logger_add_view(l, v);
+  e->pdsch_energy_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+  logger_add_view(l, v);
+  e->pdsch_energy_logger = l;  
+  l = new_ttilog(h, database,
+      "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+  logger_add_view(l, v);
+  e->pdsch_energy_logger = l;
+  
+  /* UE x PDCCH energy */
+  w = new_xy_plot(g, 128, 55, "", 50);
+  e->pdcch_energy_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+  l = new_ttilog(h, database,
+      "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+  logger_add_view(l, v);
+  e->pdcch_energy_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+  logger_add_view(l, v);
+  e->pdcch_energy_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+  logger_add_view(l, v);
+  e->pdcch_energy_logger = l;  
+  l = new_ttilog(h, database,
+      "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+  logger_add_view(l, v);
+  e->pdcch_energy_logger = l;
+    
+    /* UE x PDCCH IQ data */
+  w = new_xy_plot(g, 55, 55, "", 50);
+  e->pdcch_iq_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, -100, 100, -100, 100);
+  l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
+      "NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
+  v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
+  logger_add_view(l, v);
+  e->pdcch_iq_ue_logger = l;
+  
+  /* UE x PDCCH IQ data */
+  /*w = new_xy_plot(g, 55, 55, "", 50);
+  e->pdcch_iq_ue_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
+  l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
+  v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
+  logger_add_view(l, v);
+  e->pdcch_iq_ue_logger = l;*/
+  
+  /* UE x DL mcs */
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  w = new_xy_plot(g, 128, 55, "", 20);
+  xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
+  e->dl_mcs_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  l = new_ticked_ttilog(h, database, "UE_PHY_DL_TICK", "frame", "subframe",
+      "UE_PHY_DLSCH_UE_DCI", "mcs", 0, -1);
+  v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
+  logger_add_view(l, v);
+  e->dl_mcs_logger = l;
+
+  /* UE x UL mcs */
+  w = new_xy_plot(g, 128, 55, "", 20);
+  xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
+  e->ul_mcs_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  l = new_ticked_ttilog(h, database, "UE_PHY_UL_TICK", "frame", "subframe",
+      "UE_PHY_ULSCH_UE_DCI", "mcs", 0, -1);
+  v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
+  logger_add_view(l, v);
+  e->ul_mcs_logger = l;
+
+    /* UE x PUSCH TX Power */
+//  line = new_container(g, HORIZONTAL);
+//  widget_add_child(g, top_container, line, -1);
+  w = new_xy_plot(g, 128, 55, "", 20);
+  e->pusch_power_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 1024*10, -30, 50);
+  l = new_ttilog(h, database,
+      "UE_PHY_PUSCH_TX_POWER", "frame", "subframe", "p0_pusch", 0);
+  v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
+  logger_add_view(l, v);
+  e->pusch_power_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PUSCH_TX_POWER", "frame", "subframe", "ampl", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
+  logger_add_view(l, v);
+  e->pusch_ampl_logger = l;
+  
+      /* UE x PUCCH TX Power */
+//  line = new_container(g, HORIZONTAL);
+//  widget_add_child(g, top_container, line, -1);
+  w = new_xy_plot(g, 128, 55, "", 20);
+  e->pucch_power_xy_plot = w;
+  widget_add_child(g, line, w, -1);
+  xy_plot_set_range(g, w, 0, 1024*10, -30, 50);
+  l = new_ttilog(h, database,
+      "UE_PHY_PUCCH_TX_POWER", "frame", "subframe", "p0_pucch", 0);
+  v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
+  logger_add_view(l, v);
+  e->pucch_power_logger = l;
+  l = new_ttilog(h, database,
+      "UE_PHY_PUCCH_TX_POWER", "frame", "subframe", "ampl", 1);
+  v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
+  logger_add_view(l, v);
+  e->pucch_ampl_logger = l;
+  
+  
+  /* downlink/uplink UE DCIs */
+  widget_add_child(g, top_container,
+      new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1);
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  timeline_plot = new_timeline(g, 512, 8, 5);
+  widget_add_child(g, line, timeline_plot, -1);
+  container_set_child_growable(g, line, timeline_plot, 1);
+  for (i = 0; i < 8; i++)
+    timeline_set_subline_background_color(g, timeline_plot, i,
+        new_color(g, i==0 || i==4 ? "#aaf" : "#eee"));
+  timeview = new_view_time(3600, 10, g, timeline_plot);
+  /* DL tick logging */
+  timelog = new_timelog(h, database, "UE_PHY_DL_TICK");
+  subview = new_subview_time(timeview, 0, new_color(g, "#77c"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* DL DCI logging */
+  timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_DCI");
+  subview = new_subview_time(timeview, 1, new_color(g, "#228"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* DL ACK */
+  timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_ACK");
+  subview = new_subview_time(timeview, 2, new_color(g, "#282"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* DL NACK */
+  timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_NACK");
+  subview = new_subview_time(timeview, 3, new_color(g, "#f22"), 3600*1000);
+  logger_add_view(timelog, subview);
+
+  /* UL tick logging */
+  timelog = new_timelog(h, database, "UE_PHY_UL_TICK");
+  subview = new_subview_time(timeview, 4, new_color(g, "#77c"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* UL DCI logging */
+  timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_DCI");
+  subview = new_subview_time(timeview, 5, new_color(g, "#228"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* UL retransmission without DCI logging */
+  //timelog = new_timelog(h,database,"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION");
+  //subview = new_subview_time(timeview, 5, new_color(g, "#f22"), 3600*1000);
+  //logger_add_view(timelog, subview);
+  /* UL ACK */
+  timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_ACK");
+  subview = new_subview_time(timeview, 6, new_color(g, "#282"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* UL NACK */
+  timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_NACK");
+  subview = new_subview_time(timeview, 7, new_color(g, "#f22"), 3600*1000);
+  logger_add_view(timelog, subview);
+
+  /* harq processes' ticktime view */
+  e->dl_ul_harq_ue_label = new_label(g, "");
+  widget_add_child(g, top_container, e->dl_ul_harq_ue_label, -1);
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  timeline_plot = new_timeline(g, 512, 2*8+2, 3);
+  widget_add_child(g, line, timeline_plot, -1);
+  container_set_child_growable(g, line, timeline_plot, 1);
+  for (i = 0; i < 2*8+2; i++)
+    timeline_set_subline_background_color(g, timeline_plot, i,
+        new_color(g, i==0 || i==9 ? "#ddd" : (i%9)&1 ? "#e6e6e6" : "#eee"));
+  timeview = new_view_ticktime(10, g, timeline_plot);
+  ticktime_set_tick(timeview,
+      new_ticklog(h, database, "UE_MASTER_TICK", "frame", "subframe"));
+  /* tick */
+  timelog = new_ticklog(h, database, "UE_MASTER_TICK", "frame", "subframe");
+  /* tick on DL view */
+  subview = new_subview_ticktime(timeview, 0, new_color(g,"#bbb"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* tick on UL view */
+  subview = new_subview_ticktime(timeview, 9, new_color(g,"#bbb"), 3600*1000);
+  logger_add_view(timelog, subview);
+  /* DL DCI */
+  for (i = 0; i < 8; i++) {
+    timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_DCI",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+1,
+        new_color(g,"#55f"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->dl_dci_logger[i] = timelog;
+  }
+  /* DL ACK */
+  for (i = 0; i < 8; i++) {
+    timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_ACK",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+1,
+        new_color(g,"#282"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->dl_ack_logger[i] = timelog;
+  }
+  /* DL NACK */
+  for (i = 0; i < 8; i++) {
+    timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_NACK",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+1,
+        new_color(g,"#f22"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->dl_nack_logger[i] = timelog;
+  }
+  /* UL DCI/retransmission without DCI */
+  for (i = 0; i < 8; i++) {
+    /* first transmission */
+    timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_DCI",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+9+1,
+        new_color(g,"#55f"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->ul_dci_logger[i] = timelog;
+    /* retransmission */
+    
+    timelog = new_ticklog(h, database,
+        "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+9+1,
+        new_color(g,"#99f"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->ul_dci_retransmission_logger[i] = timelog;
+    
+  }
+
+  /* UL ACK */
+  for (i = 0; i < 8; i++) {
+    timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_ACK",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+9+1,
+        new_color(g,"#282"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->ul_ack_logger[i] = timelog;
+  }
+  /* UL NACK */
+  for (i = 0; i < 8; i++) {
+    timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_NACK",
+        "frame", "subframe");
+    subview = new_subview_ticktime(timeview, i+9+1,
+        new_color(g,"#f22"), 3600*1000);
+    logger_add_view(timelog, subview);
+    e->ul_nack_logger[i] = timelog;
+  }
+
+#if 1
+  /* phy/mac/rlc/pdcp/rrc textlog */
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  container_set_child_growable(g, top_container, line, 1);
+
+  /* phy */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, line, col, -1);
+  container_set_child_growable(g, line, col, 1);
+  widget_add_child(g, col, new_label(g, "PHY"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#afa"));
+  widget_add_child(g, col, text, -1);
+  container_set_child_growable(g, col, text, 1);
+  textview = new_view_textlist(10000, 10, g, text);
+  e->phyview = textview;
+
+  /* mac */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, line, col, -1);
+  container_set_child_growable(g, line, col, 1);
+  widget_add_child(g, col, new_label(g, "MAC"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#adf"));
+  widget_add_child(g, col, text, -1);
+  container_set_child_growable(g, col, text, 1);
+  textview = new_view_textlist(10000, 10, g, text);
+  e->macview = textview;
+
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  container_set_child_growable(g, top_container, line, 1);
+
+  /* rlc */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, line, col, -1);
+  container_set_child_growable(g, line, col, 1);
+  widget_add_child(g, col, new_label(g, "RLC"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#aff"));
+  widget_add_child(g, col, text, -1);
+  container_set_child_growable(g, col, text, 1);
+  textview = new_view_textlist(10000, 10, g, text);
+  e->rlcview = textview;
+
+  /* pdcp */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, line, col, -1);
+  container_set_child_growable(g, line, col, 1);
+  widget_add_child(g, col, new_label(g, "PDCP"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#ed9"));
+  widget_add_child(g, col, text, -1);
+  container_set_child_growable(g, col, text, 1);
+  textview = new_view_textlist(10000, 10, g, text);
+  e->pdcpview = textview;
+
+  line = new_container(g, HORIZONTAL);
+  widget_add_child(g, top_container, line, -1);
+  container_set_child_growable(g, top_container, line, 1);
+
+  /* rrc */
+  col = new_container(g, VERTICAL);
+  widget_add_child(g, line, col, -1);
+  container_set_child_growable(g, line, col, 1);
+  widget_add_child(g, col, new_label(g, "RRC"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#fdb"));
+  widget_add_child(g, col, text, -1);
+  container_set_child_growable(g, col, text, 1);
+  textview = new_view_textlist(10000, 10, g, text);
+  e->rrcview = textview;
+
+  /* legacy logs (LOG_I, LOG_D, ...) */
+  widget_add_child(g, top_container, new_label(g, "LEGACY"), -1);
+  text = new_textlist(g, 100, 10, new_color(g, "#eeb"));
+  widget_add_child(g, top_container, text, -1);
+  container_set_child_growable(g, top_container, text, 1);
+  e->legacy = new_view_textlist(10000, 10, g, text);
+#endif
+
+  set_current_ue(g, ed, 0);
+  register_notifier(g, "click", e->prev_ue_button, click, ed);
+  register_notifier(g, "click", e->next_ue_button, click, ed);
+}
+
+void view_add_log(view *v, char *log, event_handler *h, void *database,
+    int *is_on)
+{
+  logger *textlog;
+  char *name, *desc;
+
+  database_get_generic_description(database,
+      event_id_from_name(database, log), &name, &desc);
+  textlog = new_textlog(h, database, name, desc);
+  logger_add_view(textlog, v);
+  free(name);
+  free(desc);
+
+  on_off(database, log, is_on, 1);
+}
+
+int main(int n, char **v)
+{
+  extern int volatile gui_logd;
+  char *database_filename = NULL;
+  void *database;
+  char *ip = DEFAULT_REMOTE_IP;
+  int port = DEFAULT_REMOTE_PORT;
+  char **on_off_name;
+  int *on_off_action;
+  int on_off_n = 0;
+  int *is_on;
+  int number_of_events;
+  int i;
+  event_handler *h;
+  gui *g;
+  ue_gui eg;
+  ue_data ue_data;
+
+  /* write on a socket fails if the other end is closed and we get SIGPIPE */
+  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
+
+  on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort();
+  on_off_action = malloc(n * sizeof(int)); if (on_off_action == NULL) abort();
+
+  for (i = 1; i < n; i++) {
+    if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
+    if (!strcmp(v[i], "-d"))
+      { if (i > n-2) usage(); database_filename = v[++i]; continue; }
+    if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
+    if (!strcmp(v[i], "-p"))
+      { if (i > n-2) usage(); port = atoi(v[++i]); continue; }
+    if (!strcmp(v[i], "-on")) { if (i > n-2) usage();
+      on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=1; continue; }
+    if (!strcmp(v[i], "-off")) { if (i > n-2) usage();
+      on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=0; continue; }
+    if (!strcmp(v[i], "-ON"))
+      { on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=1; continue; }
+    if (!strcmp(v[i], "-OFF"))
+      { on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; }
+    if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; }
+    usage();
+  }
+
+  if (database_filename == NULL) {
+    printf("ERROR: provide a database file (-d)\n");
+    exit(1);
+  }
+
+  database = parse_database(database_filename);
+
+  load_config_file(database_filename);
+
+  number_of_events = number_of_ids(database);
+  is_on = calloc(number_of_events, sizeof(int));
+  if (is_on == NULL) abort();
+
+  h = new_handler(database);
+
+  g = gui_init();
+  new_thread(gui_thread, g);
+
+  ue_data.ue = 0;
+  ue_data.e = &eg;
+  ue_data.database = database;
+
+  ue_main_gui(&eg, g, h, database, &ue_data);
+
+  for (i = 0; i < number_of_events; i++) {
+    logger *textlog;
+    char *name, *desc;
+    database_get_generic_description(database, i, &name, &desc);
+    if (!strncmp(name, "LEGACY_", 7)) {
+      textlog = new_textlog(h, database, name, desc);
+      logger_add_view(textlog, eg.legacy);
+    }
+    free(name);
+    free(desc);
+  }
+
+  on_off(database, "UE_MASTER_TICK", is_on, 1);
+  on_off(database, "UE_PHY_UL_TICK", is_on, 1);
+  on_off(database, "UE_PHY_DL_TICK", is_on, 1);
+  on_off(database, "UE_PHY_DLSCH_UE_DCI", is_on, 1);
+  on_off(database, "UE_PHY_DLSCH_UE_ACK", is_on, 1);
+  on_off(database, "UE_PHY_DLSCH_UE_NACK", is_on, 1);
+  on_off(database, "UE_PHY_ULSCH_UE_DCI", is_on, 1);
+  on_off(database, "UE_PHY_ULSCH_UE_ACK", is_on, 1);
+  on_off(database, "UE_PHY_ULSCH_UE_NACK", is_on, 1);
+  on_off(database, "UE_PHY_INPUT_SIGNAL", is_on, 1);
+  on_off(database, "UE_PHY_DL_CHANNEL_ESTIMATE", is_on, 1);
+  on_off(database, "UE_PHY_PDCCH_IQ", is_on, 1);
+  on_off(database, "UE_PHY_PDCCH_ENERGY", is_on, 1);
+  on_off(database, "UE_PHY_PDSCH_IQ", is_on, 1);
+  on_off(database, "UE_PHY_PDSCH_ENERGY", is_on, 1);
+  on_off(database, "UE_PHY_PUSCH_TX_POWER", is_on, 1);
+  on_off(database, "UE_PHY_PUCCH_TX_POWER", is_on, 1);
+  on_off(database, "UE_PHY_MEAS", is_on, 1);
+  
+  on_off(database, "LEGACY_GROUP_INFO", is_on, 1);
+  on_off(database, "LEGACY_GROUP_ERROR", is_on, 1);
+  on_off(database, "LEGACY_GROUP_WARNING", is_on, 1);
+  
+  view_add_log(eg.phyview, "UE_PHY_UL_TICK", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_DL_TICK", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_DCI", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_ACK", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_NACK",h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_DCI", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_ACK", h, database, is_on);
+  view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_NACK", h, database, is_on);
+
+
+
+  /* deactivate those two by default, they are a bit heavy */
+  //on_off(database, "ENB_MAC_UE_UL_SDU_WITH_DATA", is_on, 0);
+  //on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 0);
+
+  for (i = 0; i < on_off_n; i++)
+    on_off(database, on_off_name[i], is_on, on_off_action[i]);
+
+  ue_data.socket = -1;
+  ue_data.is_on = is_on;
+  ue_data.nevents = number_of_events;
+  if (pthread_mutex_init(&ue_data.lock, NULL)) abort();
+  setup_event_selector(g, database, is_on, is_on_changed, &ue_data);
+
+restart:
+  clear_remote_config();
+  ue_data.socket = connect_to(ip, port);
+
+  /* send the first message - activate selected traces */
+  is_on_changed(&ue_data);
+
+  /* read messages */
+  while (1) {
+    char v[T_BUFFER_MAX];
+    event e;
+    e = get_event(ue_data.socket, v, database);
+    if (e.type == -1) goto restart;
+    if (pthread_mutex_lock(&ue_data.lock)) abort();
+    handle_event(h, e);
+    if (pthread_mutex_unlock(&ue_data.lock)) abort();
+  }
+
+  return 0;
+}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
index 45ed0f11c0d1a359fd19db11ccbf019a68091e4b..760486933ae19337e16512e2c867096da4e5b68d 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
@@ -25,6 +25,7 @@
 #include "defs.h"
 #include "PHY/defs.h"
 #include "filt96_32.h"
+#include "T.h"
 //#define DEBUG_CH
 
 int lte_dl_channel_estimation(PHY_VARS_UE *ue,
@@ -738,6 +739,12 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
              (int16_t*) ue->common_vars.dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1);
     }
 
+#if T_TRACER
+        T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id), T_INT(ue->Mod_id),
+          T_INT(ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx%1024), T_INT(ue->proc.proc_rxtx[(Ns>>1)&1].subframe_rx),
+          T_INT(0), T_BUFFER(&ue->common_vars.dl_ch_estimates_time[eNB_offset][0][0], 512  * 4));
+#endif
+
   return(0);
 }
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index 75583678176047ce1cb1f32484e9c5a6718675d5..824caa52fa49e07f6647333127a7968df9f0ef9d 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -41,6 +41,7 @@
 #include "PHY/sse_intrin.h"
 
 #include "assertions.h" 
+#include "T.h"
 
 //#define DEBUG_DCI_ENCODING 1
 //#define DEBUG_DCI_DECODING 1
@@ -1684,6 +1685,7 @@ int32_t avgP[4];
 int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
                  LTE_UE_PDCCH **pdcch_vars,
                  LTE_DL_FRAME_PARMS *frame_parms,
+                 uint32_t frame,
                  uint8_t subframe,
                  uint8_t eNB_id,
                  MIMO_mode_t mimo_mode,
@@ -1754,7 +1756,10 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
   LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs);
 #endif
 
-
+#if T_TRACER
+  T(T_UE_PHY_PDCCH_ENERGY, T_INT(eNB_id),  T_INT(0), T_INT(frame%1024), T_INT(subframe),
+                           T_INT(avgP[0]), T_INT(avgP[1]),    T_INT(avgP[2]),             T_INT(avgP[3]));
+#endif
   for (s=0; s<n_pdcch_symbols; s++) {
     pdcch_channel_compensation(pdcch_vars[eNB_id]->rxdataF_ext,
                                pdcch_vars[eNB_id]->dl_ch_estimates_ext,
@@ -1851,6 +1856,7 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
       /*#ifdef DEBUG_PHY
       write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
       #endif*/
+
 #ifdef MU_RECEIVER
     }
 
@@ -1858,6 +1864,12 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
 
   }
 
+#if T_TRACER
+  T(T_UE_PHY_PDCCH_IQ, T_INT(frame_parms->N_RB_DL), T_INT(frame_parms->N_RB_DL),
+    T_INT(n_pdcch_symbols),
+    T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4));
+#endif
+
   // decode pcfich here
   n_pdcch_symbols = rx_pcfich(frame_parms,
                               subframe,
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 61d83bafb9bc222c12689d3aae2f447eb2e2a541..e7b0cc6d45eaa9d6a4b6bf28a20afde55a7fb96d 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -5595,6 +5595,16 @@ int generate_ue_dlsch_params_from_dci(int frame,
     printf("PDSCH dlsch0 UE: pwr_off  %d\n",dlsch0_harq->dl_power_off);
   }
 
+#endif
+#if T_TRACER
+  if( (dlsch[0]->rnti != si_rnti) && (dlsch[0]->rnti != ra_rnti) && (dlsch[0]->rnti != p_rnti))
+  {
+  T(T_UE_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame%1024), T_INT(subframe), T_INT(0),
+          T_INT(dlsch[0]->rnti), T_INT(dci_format),
+          T_INT(harq_pid),
+          T_INT(dlsch0_harq->mcs),
+          T_INT(dlsch0_harq->TBS));
+  }
 #endif
   dlsch[0]->active=1;
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
index 4a80110b22fbd86bbdbeb23d49fab26c3747347a..5d0c2a96ea2a0993846221e47d6117199daa722c 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
@@ -640,6 +640,7 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
     {
     LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
     }
+    //LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
 
   }
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
index 33d798576871a02d75ee81e59e8c4cbe09f7e7b9..11d7fcacda4b51324239bb1c6329cdcc10990881 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
@@ -35,7 +35,7 @@
 #include "defs.h"
 #include "extern.h"
 #include "PHY/sse_intrin.h"
-
+#include "T.h"
 
 #ifndef USER_MODE
 #define NOCYGWIN_STATIC static
@@ -74,6 +74,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
              PDSCH_t type,
              unsigned char eNB_id,
              unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
+             uint32_t frame,
              uint8_t subframe,
              unsigned char symbol,
              unsigned char first_symbol_flag,
@@ -297,6 +298,13 @@ int rx_pdsch(PHY_VARS_UE *ue,
 
     //  avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
 
+#if T_TRACER
+    if (type == PDSCH)
+    {
+      T(T_UE_PHY_PDSCH_ENERGY, T_INT(eNB_id),  T_INT(0), T_INT(frame%1024), T_INT(subframe),
+                               T_INT(avg[0]), T_INT(avg[1]),    T_INT(avg[2]),             T_INT(avg[3]));
+    }
+#endif
 
     pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1;
     // + log2_approx(frame_parms->nb_antenna_ports_eNB-1) //-1 because log2_approx counts the number of bits
@@ -825,6 +833,15 @@ int rx_pdsch(PHY_VARS_UE *ue,
     return(-1);
     break;
   }
+
+#if T_TRACER
+  T(T_UE_PHY_PDSCH_IQ, T_INT(eNB_id), T_INT(ue->Mod_id), T_INT(frame%1024),
+    T_INT(subframe), T_INT(nb_rb),
+    T_INT(frame_parms->N_RB_UL), T_INT(frame_parms->symbols_per_tti),
+    T_BUFFER(&pdsch_vars[eNB_id]->rxdataF_comp0[eNB_id][0],
+             2 * /* ulsch[UE_id]->harq_processes[harq_pid]->nb_rb */ frame_parms->N_RB_UL *12*frame_parms->symbols_per_tti*2));
+#endif
+
   return(0);
 }
 
diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c
index 989567ca3498d075237a8b50982460748ab7cf69..9fcdc774cadb1e4af41348fdf80c29ae712380f4 100644
--- a/openair1/PHY/LTE_TRANSPORT/phich.c
+++ b/openair1/PHY/LTE_TRANSPORT/phich.c
@@ -1414,7 +1414,10 @@ void rx_phich(PHY_VARS_UE *ue,
           //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round);
       }
     }
-
+#if T_TRACER
+    T(T_UE_PHY_ULSCH_UE_NACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ue->Mod_id), T_INT(ulsch->rnti),
+      T_INT(harq_pid));
+#endif
 
   } else {  //ACK
     if (ue->ulsch_Msg3_active[eNB_id] == 1) {
@@ -1449,7 +1452,11 @@ void rx_phich(PHY_VARS_UE *ue,
     // inform MAC?
     ue->ulsch_Msg3_active[eNB_id] = 0;
 
-   //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH ACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round);
+#if T_TRACER
+    T(T_UE_PHY_ULSCH_UE_ACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ue->Mod_id), T_INT(ulsch->rnti),
+      T_INT(harq_pid));
+#endif
+
   }
 
 }
diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h
index 94aa21c7178362ace62b4161521e3f44472796e5..ef0fd131780982b5a2abcd121b265d06a305b3e5 100644
--- a/openair1/PHY/LTE_TRANSPORT/proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/proto.h
@@ -1179,6 +1179,7 @@ int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
                  PDSCH_t type,
                  uint8_t eNB_id,
                  uint8_t eNB_id_i,
+                 uint32_t frame,
                  uint8_t subframe,
                  uint8_t symbol,
                  uint8_t first_symbol_flag,
@@ -1189,6 +1190,7 @@ int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
 int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
                  LTE_UE_PDCCH **lte_ue_pdcch_vars,
                  LTE_DL_FRAME_PARMS *frame_parms,
+                 uint32_t frame,
                  uint8_t subframe,
                  uint8_t eNB_id,
                  MIMO_mode_t mimo_mode,
diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index daf560a736739b5f46852d8cb2f4a8fce4d7a3d9..846e0be1bafb184f270fdd1b9d8dd8ab690e3505 100644
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -124,6 +124,7 @@ static inline void* malloc16_clear( size_t size )
 #include "PHY/TOOLS/defs.h"
 #include "platform_types.h"
 
+#define OPENAIR_LTE
 #ifdef OPENAIR_LTE
 
 #include "PHY/LTE_TRANSPORT/defs.h"
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 98877c2e73536cc55a2dd157ba50b17ba9b81c05..859842ce658b523f59d9f8cdf1cea930428cd5e0 100644
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -66,6 +66,8 @@ fifo_dump_emos_UE emos_dump_UE;
 
 #include "PHY/CODING/extern.h"
 
+#include "T.h"
+
 #define DLSCH_RB_ALLOC 0x1fbf  // skip DC RB (total 23/25 RBs)
 #define DLSCH_RB_ALLOC_12 0x0aaa  // skip DC RB (total 23/25 RBs)
 
@@ -1311,6 +1313,22 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
       {
           ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 0;
       }
+
+#if T_TRACER
+    if(ue->ulsch[eNB_id]->o_ACK[0])
+    {
+    	LOG_I(PHY,"PUSCH ACK\n");
+        T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
+                      T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
+    }
+    else
+    {
+    	LOG_I(PHY,"PUSCH NACK\n");
+        T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
+                      T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
+    }
+#endif
+
       LOG_D(PHY,"[UE  %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n",
         Mod_id,
         ue->ulsch[eNB_id]->rnti,
@@ -1471,6 +1489,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
 			  nb_rb);
 #else
       tx_amp = AMP;
+#endif
+#if T_TRACER
+      T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
+                    T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
 #endif
       LOG_D(PHY,"[UE  %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n",
 	    Mod_id,harq_pid,frame_tx,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp);
@@ -1691,7 +1713,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 #else
     tx_amp = AMP;
 #endif
-	    
+#if T_TRACER
+      T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
+                    T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
+#endif
     if (SR_payload>0) {
       LOG_D(PHY,"[UE  %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n",
 	    Mod_id,
@@ -1714,6 +1739,21 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 	    Po_PUCCH,
 	    tx_amp);
     }
+
+#if T_TRACER
+    if(pucch_ack_payload[0])
+    {
+    	LOG_I(PHY,"PUCCH ACK\n");
+        T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
+                      T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
+    }
+    else
+    {
+    	LOG_I(PHY,"PUCCH NACK\n");
+        T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
+                      T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
+    }
+#endif
 	    
     if (abstraction_flag == 0) {
 	      
@@ -1757,6 +1797,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 			 1);
 #else
     tx_amp = AMP;
+#endif
+#if T_TRACER
+    T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
+                  T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
 #endif
     LOG_D(PHY,"[UE  %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
 	  Mod_id,
@@ -1821,6 +1865,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 			   1);
 #else
       tx_amp = AMP;
+#endif
+#if T_TRACER
+      T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
+                    T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
 #endif
       LOG_D(PHY,"[UE  %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (CQI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n",
 	    Mod_id,
@@ -1861,7 +1909,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
       }
       ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
       ue->tx_total_RE[subframe_tx] = 12;
-      
+#if T_TRACER
+      T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
+                    T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
+#endif
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
       tx_amp =  get_tx_amp(Po_PUCCH,
 			   ue->tx_power_max_dBm,
@@ -1913,6 +1964,10 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
 
+#if T_TRACER
+  T(T_UE_PHY_UL_TICK, T_INT(ue->Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx));
+#endif
+
   ue->generate_ul_signal[eNB_id] = 0;
 
   start_meas(&ue->phy_proc_tx);
@@ -2052,7 +2107,7 @@ void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_f
   }
 }
 
-void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode)
+void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id,uint8_t slot,uint8_t abstraction_flag,runmode_t mode)
 {
   
   LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
@@ -2076,6 +2131,17 @@ void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,
 			  0,
 			  1);
     }
+#if T_TRACER
+    if(slot == 0)
+      T(T_UE_PHY_MEAS, T_INT(eNB_id),  T_INT(ue->Mod_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx),
+                             T_INT((int)(10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB)),
+                             T_INT((int)ue->measurements.rx_rssi_dBm[0]),
+                             T_INT((int)(ue->measurements.rx_power_avg_dB[0] - ue->measurements.n0_power_avg_dB)),
+                             T_INT((int)ue->measurements.rx_power_avg_dB[0]),
+                             T_INT((int)ue->measurements.n0_power_avg_dB),
+                             T_INT((int)ue->measurements.wideband_cqi_avg[0]),
+                             T_INT((int)ue->common_vars.freq_offset));
+#endif
   }
 
   if (l==(6-ue->frame_parms.Ncp)) {
@@ -2492,6 +2558,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
     rx_pdcch(&ue->common_vars,
 	     ue->pdcch_vars,
 	     &ue->frame_parms,
+	     proc->frame_rx,
 	     subframe_rx,
 	     eNB_id,
 	     (ue->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -2597,7 +2664,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
 
 
       
-      //      dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
+      //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
       if ((ue->UE_mode[eNB_id] > PRACH) &&
 	  (generate_ue_dlsch_params_from_dci(frame_rx,
 					     subframe_rx,
@@ -2620,6 +2687,12 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
           {
             ue->dlsch[eNB_id][0]->g_pucch += ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->delta_PUCCH;
           }
+          
+          /*T(T_UE_PHY_DLSCH_UE_DCI, T_INT(eNB_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(ue->Mod_id),
+                  T_INT(dci_alloc_rx[i].rnti), T_INT(dci_alloc_rx[i].format),
+                  T_INT(ue->dlsch[eNB_id][0]->current_harq_pid),
+                  T_INT(ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->mcs),
+                  T_INT(ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->TBS));*/
 
 	ue->dlsch_received[eNB_id]++;
 	
@@ -2761,6 +2834,20 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
 					     eNB_id,
 					     0)==0)) {
 
+#if T_TRACER
+    LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
+    uint8_t harq_pid = subframe2harq_pid(frame_parms,
+                                 pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,proc->subframe_rx),
+                                 pdcch_alloc2ul_subframe(frame_parms,proc->subframe_rx));
+
+    T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), T_INT(ue->Mod_id),
+      T_INT(dci_alloc_rx[i].rnti), T_INT(harq_pid),
+      T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs),
+      T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round),
+      T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb),
+      T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb),
+      T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS));
+#endif
 #ifdef DEBUG_PHY_PROC
 	LOG_D(PHY,"[UE  %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
 #endif
@@ -3013,6 +3100,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
 	       pdsch,
 	       eNB_id,
 	       eNB_id_i,
+	       proc->frame_rx,
 	       subframe_rx,  // subframe,
 	       m,
 	       first_symbol_flag,
@@ -3331,6 +3419,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
 
+#if T_TRACER
+  T(T_UE_PHY_DL_TICK, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx));
+#endif
+
+  T(T_UE_PHY_INPUT_SIGNAL, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(0),
+    T_BUFFER(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti],
+             ue->frame_parms.samples_per_tti * 4));
 
   start_meas(&ue->phy_proc_rx);
 
@@ -3398,7 +3493,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
       stop_meas(&ue->ofdm_demod_stats);
     }
     
-    ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode);
+    ue_measurement_procedures(l-1,ue,proc,eNB_id,0,abstraction_flag,mode);
     if ((l==pilot1) ||
 	((pmch_flag==1)&(l==l2)))  {
       LOG_D(PHY,"[UE  %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id);
@@ -3411,7 +3506,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
     }
     
   } // for l=1..l2
-  ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode);  
+  //ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode);
   
     // If this is PMCH, call procedures and return
   if (pmch_flag == 1) {
@@ -3502,7 +3597,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 	stop_meas(&ue->ofdm_demod_stats);
       }
       
-      ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode);
+      ue_measurement_procedures(l-1,ue,proc,eNB_id,1,abstraction_flag,mode);
       
     } // for l=1..l2
 
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
index 66dea185de1a039af9cdda09e6660961af5837f6..641efd2ed98c6ac4ed1efa4ff4277008ff8f435f 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
@@ -3199,6 +3199,7 @@ PMI_FEEDBACK:
                   rx_pdcch(&UE->common_vars,
                            UE->pdcch_vars,
                            &UE->frame_parms,
+                           0, // frame
                            subframe,
                            0,
                            (UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -3405,6 +3406,7 @@ PMI_FEEDBACK:
                                  PDSCH,
                                  eNB_id,
                                  eNB_id_i,
+                                 0, // frame
                                  subframe,
                                  m,
                                  (m==UE->pdcch_vars[0]->num_pdcch_symbols)?1:0,
@@ -3430,6 +3432,7 @@ PMI_FEEDBACK:
                                  PDSCH,
                                  eNB_id,
                                  eNB_id_i,
+                                 0, // frame
                                  subframe,
                                  m,
                                  0,
@@ -3455,6 +3458,7 @@ PMI_FEEDBACK:
                                  PDSCH,
                                  eNB_id,
                                  eNB_id_i,
+                                 0, // frame
                                  subframe,
                                  m,
                                  0,
diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
index 04b9d304b39d21be6cefb42d997d2b2bda9c99d2..909468366b706191e6c6c0fe0701b137623c8f40 100644
--- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
@@ -1091,6 +1091,7 @@ int main(int argc, char **argv)
           rx_pdcch(&UE->common_vars,
                    UE->pdcch_vars,
                    &UE->frame_parms,
+                   frame,
                    subframe,
                    0,
                    (UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c
index 7e94122e68468090d756dd45caed7d248f579299..f19f71c76f4f4837197569fbee53f54e62a0d5a4 100644
--- a/openair1/SIMULATION/LTE_PHY/syncsim.c
+++ b/openair1/SIMULATION/LTE_PHY/syncsim.c
@@ -1490,6 +1490,7 @@ int main(int argc, char **argv)
             rx_pdcch(&PHY_vars_UE[UE_idx]->lte_ue_common_vars,
                      PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars,
                      &PHY_vars_UE[UE_idx]->lte_frame_parms,
+                     frame,
                      subframe,
                      0,
                      (PHY_vars_UE[UE_idx]->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -1534,6 +1535,7 @@ int main(int argc, char **argv)
                          PDSCH,
                          0,
                          1,
+                         frame,
                          subframe,  // subframe,
                          l,  // symbol
                          (l==PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0,   // first_symbol_flag
@@ -1564,6 +1566,7 @@ int main(int argc, char **argv)
                          PDSCH,
                          0,
                          1,
+                         frame,
                          subframe,  // subframe,
                          l,  // symbol
                          0,   // first_symbol_flag
@@ -1588,6 +1591,7 @@ int main(int argc, char **argv)
                          PDSCH,
                          0,
                          1,
+                         frame,
                          subframe,  // subframe,
                          l,  // symbol
                          0,   // first_symbol_flag
@@ -1618,6 +1622,7 @@ int main(int argc, char **argv)
                          PDSCH,
                          0,
                          1,
+                         frame,
                          subframe,  // subframe,
                          l,  // symbol
                          0,   // first_symbol_flag
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 5ab6b7cddf0491e6f5fe03b70101d4781e4707a7..e71c18a2c159ab3f84e132fc910de92973378e6f 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -75,6 +75,8 @@
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 
+#include "T.h"
+
 #define FRAME_PERIOD    100000000ULL
 #define DAQ_PERIOD      66667ULL
 
@@ -1182,6 +1184,9 @@ void *UE_thread(void *arg) {
 	  proc->frame_tx = proc->frame_rx + ((proc->subframe_rx>5)?1:0);
 	  proc->timestamp_tx = timestamp+(4*UE->frame_parms.samples_per_tti)-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
 
+#if T_TRACER
+	  T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx));
+#endif
 	  /*
 	  if (sf != (timestamp/UE->frame_parms.samples_per_tti)%10) {
 	    LOG_E(PHY,"steady-state UE_thread error : frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d, rx subframe %d\n",proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx,(timestamp/UE->frame_parms.samples_per_tti)%10);