Commit a61af35a authored by winckel's avatar winckel

Changed ITTI instance type and default and all values.

Added a sub task ID identification in logs.

pre-ci Ok.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4542 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 8bf78981
......@@ -117,10 +117,10 @@ typedef union msg_s
#undef MESSAGE_DEF
} msg_t;
#define INSTANCE_DEFAULT 0
#define INSTANCE_ALL -1
#define INSTANCE_DEFAULT (UINT16_MAX - 1)
#define INSTANCE_ALL (UINT16_MAX)
typedef int16_t instance_t;
typedef uint16_t instance_t;
typedef uint16_t MessageHeaderSize;
typedef struct itti_lte_time_s
......
......@@ -53,4 +53,10 @@ typedef struct {
char signal_name[SIGNAL_NAME_LENGTH];
} itti_signal_header_t;
#define INSTANCE_DEFAULT (UINT16_MAX - 1)
#define INSTANCE_ALL (UINT16_MAX)
typedef uint16_t instance_t;
#endif
......@@ -79,20 +79,6 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Enable messages filtering");
}
ui_tree_view_refilter ();
if (ui_main_data.messages_list != NULL)
{
GtkTreePath *path_row;
/* Get the currently selected message */
gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL);
if (path_row != NULL)
{
/* Center the message in the middle of the list if possible */
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5,
0.0);
}
}
}
return TRUE;
......@@ -171,7 +157,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
char label[100];
gtk_tree_model_get (model, &iter, COL_MSG_NUM, &message_number, COL_MESSAGE_ID, &message_id,
COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE,
COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE_ID,
&instance, COL_BUFFER, &buffer, -1);
g_debug(" Get iter %p %p", buffer_current, buffer);
......
......@@ -110,7 +110,7 @@ int ui_filters_search_id(ui_filter_t *filter, uint32_t value)
}
}
return (item);
return (-1);
}
static void ui_filter_set_enabled(uint8_t *enabled, ui_entry_enabled_e entry_enabled, gboolean new)
......@@ -214,7 +214,7 @@ static gboolean ui_item_enabled(ui_filter_t *filter, const uint32_t value)
{
item = ui_filters_search_id (filter, value);
if (item < filter->used)
if (item >= 0)
{
return (filter->items[item].enabled ? TRUE : FALSE);
}
......
......@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include "logs.h"
#include "itti_types.h"
#include "rc.h"
......@@ -196,6 +197,7 @@ int ui_messages_read(char *filename)
read_data = 0;
}
ui_gtk_flush_events ();
g_message("Parsed XML definition from file \"%s\"", filename);
break;
case ITTI_STATISTIC_MESSAGE_TYPE:
......
......@@ -46,7 +46,7 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
if (ui_filters.filters_enabled)
{
gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID,
&origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1);
&origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE_ID, &instance, -1);
if (msg_number != 0)
{
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance);
......@@ -141,12 +141,13 @@ static void ui_tree_view_init_list(GtkWidget *list)
G_TYPE_STRING, // COL_MESSAGE
G_TYPE_STRING, // COL_FROM_TASK
G_TYPE_STRING, // COL_TO_TASK
G_TYPE_UINT, // COL_INSTANCE
G_TYPE_STRING, // COL_INSTANCE
// Not displayed columns
// Id of some message fields to speed-up filtering
G_TYPE_UINT, // COL_MESSAGE_ID
G_TYPE_UINT, // COL_FROM_TASK_ID
G_TYPE_UINT, // COL_TO_TASK_ID
G_TYPE_UINT, // COL_INSTANCE_ID
G_TYPE_STRING, // COL_FOREGROUND
G_TYPE_STRING, // COL_BACKGROUND
G_TYPE_BOOLEAN, // COL_STRIKETHROUGH
......@@ -169,23 +170,28 @@ static void ui_tree_view_init_list(GtkWidget *list)
static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, const uint32_t message_number,
const uint32_t message_id, const gchar *signal_name, const uint32_t origin_task_id,
const char *origin_task, const uint32_t destination_task_id,
const char *destination_task, uint32_t instance, gpointer buffer)
const char *origin_task_name, const uint32_t destination_task_id,
const char *destination_task_name, uint32_t instance_id, const char *instance_name, gpointer buffer)
{
GtkTreeIter iter;
gboolean enabled;
int message_index;
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance);
int message_index = ui_filters_search_id (&ui_filters.messages, message_id);
g_info("ui_tree_view_add_to_list: %d %d %d %d %d", message_number, message_id, origin_task_id, destination_task_id, instance_id);
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance_id);
message_index = ui_filters_search_id (&ui_filters.messages, message_id);
g_info("ui_tree_view_add_to_list: %d %d", enabled, message_index);
gtk_list_store_append (ui_store.store, &iter);
gtk_list_store_set (ui_store.store, &iter,
/* Columns */
COL_MSG_NUM,
message_number, COL_LTE_TIME, lte_time, COL_MESSAGE, signal_name, COL_FROM_TASK, origin_task,
COL_TO_TASK, destination_task, COL_INSTANCE, instance, COL_MESSAGE_ID, message_id,
COL_FROM_TASK_ID, origin_task_id, COL_TO_TASK_ID, destination_task_id, COL_BUFFER, buffer,
COL_FOREGROUND, ui_filters.messages.items[message_index].foreground, COL_BACKGROUND,
message_number, COL_LTE_TIME, lte_time, COL_MESSAGE, signal_name, COL_FROM_TASK, origin_task_name,
COL_TO_TASK, destination_task_name, COL_INSTANCE, instance_name, COL_MESSAGE_ID, message_id,
COL_FROM_TASK_ID, origin_task_id, COL_TO_TASK_ID, destination_task_id, COL_INSTANCE_ID, instance_id,
COL_BUFFER, buffer, COL_FOREGROUND, ui_filters.messages.items[message_index].foreground, COL_BACKGROUND,
ui_filters.messages.items[message_index].background, COL_STRIKETHROUGH, !enabled,
/* End of columns */
-1);
......@@ -371,7 +377,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
ui_tree_view_init_list (ui_main_data.messages_list);
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW(ui_main_data.messages_list), TRUE);
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW(scrolled_window), 670);
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW(scrolled_window), 680);
gtk_paned_pack1 (GTK_PANED (hbox), scrolled_window, FALSE, TRUE);
ui_main_data.text_view = ui_signal_dissect_new (hbox);
......@@ -395,26 +401,55 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
}
int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_time, const uint32_t message_id,
const char *message_name, const uint32_t origin_task_id, const char *origin_task,
const uint32_t destination_task_id, const char *destination_task, uint32_t instance,
const char *message_name, const uint32_t origin_task_id, const char *origin_task_name,
const uint32_t destination_task_id, const char *destination_task_name, uint32_t instance_id,
gpointer buffer)
{
if (ui_store.instance_number < (instance + 1))
char *instance_name = NULL;
char instance_name_buffer[10];
if (((instance_t) instance_id) < INSTANCE_DEFAULT)
{
if (ui_store.instance_number < (instance_id + 1))
{
int i;
for (i = ui_store.instance_number; i <= instance_id; i++)
{
sprintf (instance_name_buffer, "%d", i);
ui_filters_add (FILTER_INSTANCES, i, instance_name_buffer, ENTRY_ENABLED_TRUE, NULL, NULL);
}
ui_store.instance_number = (instance_id + 1);
ui_destroy_filter_menu (FILTER_INSTANCES);
}
sprintf (instance_name_buffer, "%d", instance_id);
instance_name = instance_name_buffer;
}
else
{
int i;
char name[10];
switch ((instance_t) instance_id)
{
case INSTANCE_DEFAULT:
instance_name = "DEF";
break;
case INSTANCE_ALL:
instance_name = "ALL";
break;
default:
break;
}
for (i = ui_store.instance_number; i <= instance; i++)
if ((instance_name != NULL) && (ui_filters_search_id (&ui_filters.instances, instance_id) < 0))
{
sprintf (name, "%d", i);
ui_filters_add (FILTER_INSTANCES, i, name, ENTRY_ENABLED_TRUE, NULL, NULL);
ui_filters_add (FILTER_INSTANCES, instance_id, instance_name, ENTRY_ENABLED_TRUE, NULL, NULL);
}
ui_store.instance_number = (instance + 1);
ui_destroy_filter_menu (FILTER_INSTANCES);
}
ui_tree_view_add_to_list (ui_main_data.messages_list, lte_time, message_number, message_id, message_name,
origin_task_id, origin_task, destination_task_id, destination_task, instance,
origin_task_id, origin_task_name, destination_task_id, destination_task_name, instance_id, instance_name,
(buffer_t *) buffer);
return RC_OK;
......@@ -430,7 +465,7 @@ void ui_tree_view_select_row(gint row)
if ((ui_main_data.messages_list != NULL) && (path_row != NULL))
{
g_debug("Select row %d", row);
g_info("Select row %d", row);
/* Select the message in requested row */
gtk_tree_view_set_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, FALSE);
......@@ -451,7 +486,7 @@ static gboolean updateColors(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter
int message_index;
gtk_tree_model_get (model, iter, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID,
&destination_task_id, COL_INSTANCE, &instance, -1);
&destination_task_id, COL_INSTANCE_ID, &instance, -1);
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance);
message_index = ui_filters_search_id (&ui_filters.messages, message_id);
......@@ -471,6 +506,21 @@ void ui_tree_view_refilter()
if (ui_store.store != NULL)
{
gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), updateColors, NULL);
if (ui_main_data.messages_list != NULL)
{
GtkTreePath *path_row;
/* Get the currently selected message */
gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL);
if (path_row != NULL)
{
/* Center the message in the middle of the list if possible */
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5,
0.0);
g_info("ui_tree_view_refilter: center on message");
}
}
}
g_info("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
......
......@@ -15,6 +15,7 @@ typedef enum col_type_e
COL_MESSAGE_ID,
COL_FROM_TASK_ID,
COL_TO_TASK_ID,
COL_INSTANCE_ID,
COL_FOREGROUND,
COL_BACKGROUND,
COL_STRIKETHROUGH,
......
......@@ -81,6 +81,10 @@ static int gfd;
static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_ORANGE, LOG_BLUE, "", ""}; /*!< \brief Optional start-format strings for highlighting */
static char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET,LOG_RESET, "",""}; /*!< \brief Optional end-format strings for highlighting */
#if defined(ENABLE_ITTI)
static log_instance_type_t log_instance_type;
#endif
int logInit (void)
{
#ifdef USER_MODE
......@@ -655,6 +659,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
#if defined(ENABLE_ITTI)
if (level <= LOG_DEBUG)
{
task_id_t origin_task_id = TASK_UNKNOWN;
MessagesIds messages_id;
MessageDef *message_p;
size_t message_string_size;
......@@ -662,6 +667,76 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
message_string_size = log_end - log_start;
#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
/* Try to identify sub task ID from log information (comp, log_instance_type) */
switch (comp)
{
case PHY:
switch (log_instance_type)
{
case LOG_INSTANCE_ENB:
origin_task_id = TASK_PHY_ENB;
break;
case LOG_INSTANCE_UE:
origin_task_id = TASK_PHY_UE;
break;
default:
break;
}
break;
case MAC:
switch (log_instance_type)
{
case LOG_INSTANCE_ENB:
origin_task_id = TASK_MAC_ENB;
break;
case LOG_INSTANCE_UE:
origin_task_id = TASK_MAC_UE;
default:
break;
}
break;
case RLC:
switch (log_instance_type)
{
case LOG_INSTANCE_ENB:
origin_task_id = TASK_RLC_ENB;
break;
case LOG_INSTANCE_UE:
origin_task_id = TASK_RLC_UE;
default:
break;
}
break;
case PDCP:
switch (log_instance_type)
{
case LOG_INSTANCE_ENB:
origin_task_id = TASK_PDCP_ENB;
break;
case LOG_INSTANCE_UE:
origin_task_id = TASK_PDCP_UE;
default:
break;
}
break;
default:
break;
}
#endif
switch (level)
{
case LOG_EMERG:
......@@ -687,7 +762,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
messages_id = DEBUG_LOG;
break;
}
message_p = itti_alloc_new_message_sized(TASK_UNKNOWN, messages_id, message_string_size);
message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
switch (level)
{
case LOG_EMERG:
......@@ -870,6 +945,13 @@ void logClean (void)
}
#if defined(ENABLE_ITTI)
void log_set_instance_type (log_instance_type_t instance)
{
log_instance_type = instance;
}
#endif
#ifdef LOG_TEST
int main(int argc, char *argv[])
......
......@@ -323,6 +323,16 @@ extern pthread_cond_t log_notify;
extern int log_shutdown;
#endif
#if defined(ENABLE_ITTI)
typedef enum log_instance_type_e {
LOG_INSTANCE_UNKNOWN,
LOG_INSTANCE_ENB,
LOG_INSTANCE_UE,
} log_instance_type_t;
void log_set_instance_type (log_instance_type_t instance);
#endif
/*--- INCLUDES ---------------------------------------------------------------*/
# include "log_if.h"
/*----------------------------------------------------------------------------*/
......
......@@ -611,6 +611,10 @@ void *l2l1_task(void *args_p) {
if(Channel_Flag==0)
#endif
{
#if defined(ENABLE_ITTI)
log_set_instance_type (LOG_INSTANCE_ENB);
#endif
if ((next_slot % 2) == 0)
clear_eNB_transport_info (oai_emulation.info.nb_enb_local);
......@@ -657,6 +661,10 @@ void *l2l1_task(void *args_p) {
// Call ETHERNET emulation here
//emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type, ethernet_flag);
#if defined(ENABLE_ITTI)
log_set_instance_type (LOG_INSTANCE_UE);
#endif
if ((next_slot % 2) == 0)
clear_UE_transport_info (oai_emulation.info.nb_ue_local);
......
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