+ {
+ /* find the tracehooks */
+ LttvTracesetContext *tsc = lttvwindow_get_traceset_context(tab);
+
+ LttvTraceset *traceset = tsc->ts;
+
+ guint i, k, l, nb_trace;
+
+ LttvTraceState *ts;
+
+ LttvTracefileState *tfs;
+
+ GArray *hooks;
+
+ LttvTraceHook *hook;
+
+ LttvTraceHook *th;
+
+ guint ret;
+ gint first_after;
+
+ nb_trace = lttv_traceset_number(traceset);
+ // FIXME (fixed) : eventually request for more traces
+ for(i = 0 ; i < nb_trace ; i++) {
+ EventsRequest *events_request = g_new(EventsRequest, 1);
+ // Create the hooks
+ //LttvHooks *event = lttv_hooks_new();
+ LttvHooksById *event_by_id = lttv_hooks_by_id_new();
+ LttvHooks *before_chunk_traceset = lttv_hooks_new();
+ LttvHooks *after_chunk_traceset = lttv_hooks_new();
+ LttvHooks *before_request_hook = lttv_hooks_new();
+ LttvHooks *after_request_hook = lttv_hooks_new();
+
+ lttv_hooks_add(before_chunk_traceset,
+ before_chunk,
+ events_request,
+ LTTV_PRIO_DEFAULT);
+
+ lttv_hooks_add(after_chunk_traceset,
+ after_chunk,
+ events_request,
+ LTTV_PRIO_DEFAULT);
+
+ lttv_hooks_add(before_request_hook,
+ before_request,
+ events_request,
+ LTTV_PRIO_DEFAULT);
+
+ lttv_hooks_add(after_request_hook,
+ after_request,
+ events_request,
+ LTTV_PRIO_DEFAULT);
+
+
+ ts = (LttvTraceState *)tsc->traces[i];
+
+ /* Find the eventtype id for the following events and register the
+ associated by id hooks. */
+
+ hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 18);
+
+ /* before hooks */
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL_ARCH,
+ LTT_EVENT_SYSCALL_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL_ARCH,
+ LTT_EVENT_SYSCALL_EXIT,
+ NULL,
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL_ARCH,
+ LTT_EVENT_TRAP_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_TRAP_ID),
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL_ARCH,
+ LTT_EVENT_TRAP_EXIT,
+ NULL,
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_IRQ_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_IRQ_ID),
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_IRQ_EXIT,
+ NULL,
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_SOFT_IRQ_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_SOFT_IRQ_EXIT,
+ NULL,
+ before_execmode_hook,
+ events_request,
+ &hooks);
+
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_SCHED_SCHEDULE,
+ FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
+ before_schedchange_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_PROCESS_EXIT,
+ FIELD_ARRAY(LTT_FIELD_PID),
+ before_process_exit_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_PROCESS_FREE,
+ FIELD_ARRAY(LTT_FIELD_PID),
+ before_process_release_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_LIST,
+ LTT_EVENT_STATEDUMP_END,
+ NULL,
+ before_statedump_end,
+ events_request,
+ &hooks);
+
+ /* After hooks */
+ first_after = hooks->len;
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_SCHED_SCHEDULE,
+ FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
+ after_schedchange_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_PROCESS_FORK,
+ FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
+ after_process_fork_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_KERNEL,
+ LTT_EVENT_PROCESS_EXIT,
+ FIELD_ARRAY(LTT_FIELD_PID),
+ after_process_exit_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_FS,
+ LTT_EVENT_EXEC,
+ NULL,
+ after_fs_exec_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_USER_GENERIC,
+ LTT_EVENT_THREAD_BRAND,
+ FIELD_ARRAY(LTT_FIELD_NAME),
+ after_user_generic_thread_brand_hook,
+ events_request,
+ &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_FACILITY_LIST,
+ LTT_EVENT_PROCESS_STATE,
+ FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
+ after_event_enum_process_hook,
+ events_request,
+ &hooks);
+
+
+ /* Add these hooks to each event_by_id hooks list */
+ /* add before */
+ for(k = 0 ; k < first_after ; k++) {
+ th = &g_array_index(hooks, LttvTraceHook, k);
+ lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+ th->h,
+ th,
+ LTTV_PRIO_STATE-5);
+ }
+
+ /* add after */
+ for(k = first_after ; k < hooks->len ; k++) {
+ th = &g_array_index(hooks, LttvTraceHook, k);
+ lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+ th->h,
+ th,
+ LTTV_PRIO_STATE+5);
+ }
+
+ events_request->hooks = hooks;
+
+ // Fill the events request
+ events_request->owner = control_flow_data;
+ events_request->viewer_data = control_flow_data;
+ events_request->servicing = FALSE;
+ events_request->start_time = start;
+ events_request->start_position = NULL;
+ events_request->stop_flag = FALSE;
+ events_request->end_time = time_end;
+ events_request->num_events = G_MAXUINT;
+ events_request->end_position = NULL;
+ events_request->trace = i; //fixed /* FIXME */
+ events_request->before_chunk_traceset = before_chunk_traceset;
+ events_request->before_chunk_trace = NULL;
+ events_request->before_chunk_tracefile = NULL;
+ events_request->event = NULL;
+ events_request->event_by_id = event_by_id;
+ events_request->after_chunk_tracefile = NULL;
+ events_request->after_chunk_trace = NULL;
+ events_request->after_chunk_traceset = after_chunk_traceset;
+ events_request->before_request = before_request_hook;
+ events_request->after_request = after_request_hook;
+
+ g_debug("req : start : %lu, %lu", start.tv_sec,
+ start.tv_nsec);
+
+ g_debug("req : end : %lu, %lu", time_end.tv_sec,
+ time_end.tv_nsec);
+
+ lttvwindow_events_request(tab, events_request);
+ }
+ }
+}
+
+
+static void set_last_start(gpointer key, gpointer value, gpointer user_data)
+{
+ ProcessInfo *process_info = (ProcessInfo*)key;
+ HashedProcessData *hashed_process_data = (HashedProcessData*)value;
+ guint x = (guint)user_data;
+
+ hashed_process_data->x.over = x;
+ hashed_process_data->x.over_used = FALSE;
+ hashed_process_data->x.over_marked = FALSE;
+ hashed_process_data->x.middle = x;
+ hashed_process_data->x.middle_used = FALSE;
+ hashed_process_data->x.middle_marked = FALSE;
+ hashed_process_data->x.under = x;
+ hashed_process_data->x.under_used = FALSE;
+ hashed_process_data->x.under_marked = FALSE;
+ hashed_process_data->next_good_time = ltt_time_zero;
+
+ return;
+}
+
+void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState *tss)
+{
+ g_debug("Begin of data request");
+ ControlFlowData *cfd = events_request->viewer_data;
+ LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tss);
+ TimeWindow time_window =
+ lttvwindow_get_time_window(cfd->tab);
+
+ guint width = cfd->drawing->width;
+ guint x=0;
+
+ cfd->drawing->last_start = events_request->start_time;
+
+ convert_time_to_pixels(
+ time_window,
+ events_request->start_time,
+ width,
+ &x);
+
+ g_hash_table_foreach(cfd->process_list->process_hash, set_last_start,
+ (gpointer)x);
+
+}
+
+void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss)
+{
+ g_debug("Begin of chunk");
+ ControlFlowData *cfd = events_request->viewer_data;
+ LttvTracesetContext *tsc = &tss->parent.parent;
+ //LttTime current_time = lttv_traceset_context_get_current_tfc(tsc)->timestamp;
+ guint i;
+ LttvTraceset *traceset = tsc->ts;
+ guint nb_trace = lttv_traceset_number(traceset);