static GSList *sEvent_Viewer_Data_List = NULL ;
/** hook functions for update time interval, current time ... */
-gboolean updateTimeInterval(void * hook_data, void * call_data);
+gboolean updateTimeWindow(void * hook_data, void * call_data);
gboolean updateCurrentTime(void * hook_data, void * call_data);
void remove_item_from_queue(GQueue * q, gboolean fromHead);
void remove_all_items_from_queue(GQueue * q);
typedef struct _EventViewerData {
mainWindow * mw;
- TimeInterval time_interval;
+ TimeWindow time_window;
LttTime current_time;
LttvHooks * before_event_hooks;
GQueue * raw_trace_data_queue_tmp; //tmp buf to contain raw data
unsigned current_event_index;
double previous_value; //value of the slide
- LttTime trace_start;
- LttTime trace_end;
+ TimeInterval time_span;
+ // LttTime trace_start;
+ // LttTime trace_end;
unsigned start_event_index; //the first event shown in the window
unsigned end_event_index; //the last event shown in the window
GtkCellRenderer *renderer;
EventViewerData* Event_Viewer_Data = g_new(EventViewerData,1) ;
RawTraceData * data;
- double time_value;
unsigned size;
Event_Viewer_Data->mw = pmParentWindow;
- GetTimeInterval(Event_Viewer_Data->mw, &Event_Viewer_Data->time_interval);
+ GetTimeWindow(Event_Viewer_Data->mw, &Event_Viewer_Data->time_window);
GetCurrentTime(Event_Viewer_Data->mw, &Event_Viewer_Data->current_time);
Event_Viewer_Data->before_event_hooks = lttv_hooks_new();
Event_Viewer_Data->raw_trace_data_queue = g_queue_new();
Event_Viewer_Data->raw_trace_data_queue_tmp = g_queue_new();
- RegUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw);
+ RegUpdateTimeWindow(updateTimeWindow,Event_Viewer_Data, Event_Viewer_Data->mw);
RegUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw);
Event_Viewer_Data->Scroll_Win = gtk_scrolled_window_new (NULL, NULL);
Event_Viewer_Data->Num_Visible_Events = 1;
//get the life span of the traceset and set the upper of the scroll bar
- getTracesetTimeSpan(Event_Viewer_Data->mw, &Event_Viewer_Data->trace_start,
- &Event_Viewer_Data->trace_end);
- time_value = Event_Viewer_Data->trace_end.tv_sec - Event_Viewer_Data->trace_start.tv_sec;
- time_value *= NANSECOND_CONST;
- time_value += (double)Event_Viewer_Data->trace_end.tv_nsec - Event_Viewer_Data->trace_start.tv_nsec;
- Event_Viewer_Data->VAdjust_C->upper = time_value;
+ getTracesetTimeSpan(Event_Viewer_Data->mw, &Event_Viewer_Data->time_span);
+
+ start = ltt_time_sub(Event_Viewer_Data->time_span.endTime, Event_Viewer_Data->time_span.startTime);
+ Event_Viewer_Data->VAdjust_C->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
Event_Viewer_Data->append = TRUE;
gtk_tree_view_get_cursor(GTK_TREE_VIEW(Event_Viewer_Data->Tree_V), &path, NULL);
if(gtk_tree_model_get_iter(model,&iter,path)){
gtk_tree_model_get(model, &iter, TIME_COLUMN, &time, -1);
- ltt_time.tv_sec = time / NANSECOND_CONST;
- ltt_time.tv_nsec = time % NANSECOND_CONST;
+ ltt_time.tv_sec = time / NANOSECONDS_PER_SECOND;
+ ltt_time.tv_nsec = time % NANOSECONDS_PER_SECOND;
if(ltt_time.tv_sec != Event_Viewer_Data->current_time.tv_sec ||
ltt_time.tv_nsec != Event_Viewer_Data->current_time.tv_nsec)
remove_all_items_from_queue(Event_Viewer_Data->raw_trace_data_queue);
end.tv_sec = G_MAXULONG;
end.tv_nsec = G_MAXULONG;
- start = Event_Viewer_Data->trace_start;
- value = (int)(time_value / NANSECOND_CONST);
- start.tv_sec += value;
- value = time_value / NANSECOND_CONST - value;
- value *= NANSECOND_CONST;
- start.tv_nsec += value;
- if(start.tv_nsec > NANSECOND_CONST){
- start.tv_sec++;
- start.tv_nsec -= NANSECOND_CONST;
- }
+ time = ltt_time_from_double(time_value / NANOSECONDS_PER_SECOND);
+ start = ltt_time_add(Event_Viewer_Data->time_span.startTime, time);
Event_Viewer_Data->previous_value = time_value;
get_events(Event_Viewer_Data, start, end, RESERVE_SMALL_SIZE,&size);
if(size < List_Height){
if(direction != SCROLL_NONE && direction != SCROLL_JUMP){
first = Event_Viewer_Data->raw_trace_data_queue->head;
raw_data = (RawTraceData*)g_list_nth_data(first,Event_Number);
- value = raw_data->time.tv_sec;
- value -= Event_Viewer_Data->trace_start.tv_sec;
- value *= NANSECOND_CONST;
- value -= Event_Viewer_Data->trace_start.tv_nsec;
- value += raw_data->time.tv_nsec;
- Event_Viewer_Data->VAdjust_C->value = value;
+ time = ltt_time_sub(raw_data->time, Event_Viewer_Data->time_span.startTime);
+ Event_Viewer_Data->VAdjust_C->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
g_signal_stop_emission_by_name(G_OBJECT(Event_Viewer_Data->VAdjust_C), "value-changed");
Event_Viewer_Data->previous_value = value;
}
// Add a new row to the model
real_data = raw_data->time.tv_sec;
- real_data *= NANSECOND_CONST;
+ real_data *= NANOSECONDS_PER_SECOND;
real_data += raw_data->time.tv_nsec;
gtk_list_store_append (Event_Viewer_Data->Store_M, &iter);
gtk_list_store_set (Event_Viewer_Data->Store_M, &iter,
g_queue_free(Event_Viewer_Data->raw_trace_data_queue);
g_queue_free(Event_Viewer_Data->raw_trace_data_queue_tmp);
- UnregUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw);
+ UnregUpdateTimeWindow(updateTimeWindow,Event_Viewer_Data, Event_Viewer_Data->mw);
UnregUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw);
sEvent_Viewer_Data_List = g_slist_remove(sEvent_Viewer_Data_List, Event_Viewer_Data);
//gtk_widget_destroy(GTK_WIDGET(Event_Viewer_Data->Store_M));
g_warning("Delete Event data from destroy\n");
- GuiEvents_free(Event_Viewer_Data);
+ //GuiEvents_free(Event_Viewer_Data);
}
//FIXME : call hGuiEvents_Destructor for corresponding data upon widget destroy
}
-gboolean updateTimeInterval(void * hook_data, void * call_data)
+gboolean updateTimeWindow(void * hook_data, void * call_data)
{
EventViewerData *Event_Viewer_Data = (EventViewerData*) hook_data;
- Event_Viewer_Data->time_interval = *(TimeInterval*)call_data;
+ Event_Viewer_Data->time_window = *(TimeWindow*)call_data;
return FALSE;
}
{
EventViewerData *Event_Viewer_Data = (EventViewerData*) hook_data;
Event_Viewer_Data->current_time = *(LttTime*)call_data;
- uint64_t nsec = Event_Viewer_Data->current_time.tv_sec * NANSECOND_CONST
+ uint64_t nsec = Event_Viewer_Data->current_time.tv_sec * NANOSECONDS_PER_SECOND
+ Event_Viewer_Data->current_time.tv_nsec;
GtkTreeIter iter;
uint64_t time;