- draw_context_out->current->middle->y = y_out+height/2;
- draw_context_out->current->status = process_out->state->s;
-
- /* for pid_out : remove previous, Prev = current, new current (default) */
- g_free(draw_context_out->previous->modify_under);
- g_free(draw_context_out->previous->modify_middle);
- g_free(draw_context_out->previous->modify_over);
- g_free(draw_context_out->previous->under);
- g_free(draw_context_out->previous->middle);
- g_free(draw_context_out->previous->over);
- g_free(draw_context_out->previous);
-
- draw_context_out->previous = draw_context_out->current;
-
- draw_context_out->current = g_new(DrawInfo,1);
- draw_context_out->current->over = g_new(ItemInfo,1);
- draw_context_out->current->over->x = -1;
- draw_context_out->current->over->y = -1;
- draw_context_out->current->middle = g_new(ItemInfo,1);
- draw_context_out->current->middle->x = -1;
- draw_context_out->current->middle->y = -1;
- draw_context_out->current->under = g_new(ItemInfo,1);
- draw_context_out->current->under->x = -1;
- draw_context_out->current->under->y = -1;
- draw_context_out->current->modify_over = g_new(ItemInfo,1);
- draw_context_out->current->modify_over->x = -1;
- draw_context_out->current->modify_over->y = -1;
- draw_context_out->current->modify_middle = g_new(ItemInfo,1);
- draw_context_out->current->modify_middle->x = -1;
- draw_context_out->current->modify_middle->y = -1;
- draw_context_out->current->modify_under = g_new(ItemInfo,1);
- draw_context_out->current->modify_under->x = -1;
- draw_context_out->current->modify_under->y = -1;
- draw_context_out->current->status = LTTV_STATE_UNNAMED;
-
- /* Finally, update the drawing context of the pid_in. */
-
- DrawContext *draw_context_in = hashed_process_data_in->draw_context;
- //draw_context_in->current->modify_over->x = x;
- draw_context_in->current->modify_over->y = y_in;
- draw_context_in->drawable = control_flow_data->drawing->pixmap;
- draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
- widget = control_flow_data->drawing->drawing_area;
- //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
- draw_context_in->gc = widget->style->black_gc;
-
- //draw_arc((void*)&prop_arc, (void*)draw_context_in);
- //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
-
- GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 };
- GdkColor colorbg_in = { 0, 0xffff, 0xffff, 0xffff };
- PropertiesText prop_text_in;
- prop_text_in.foreground = &colorfg_in;
- prop_text_in.background = &colorbg_in;
- prop_text_in.size = 10;
- prop_text_in.position = OVER;
-
- /* Print status of the process : U, WF, WC, E, W, R */
- if(process_in->state->s == LTTV_STATE_UNNAMED)
- prop_text_in.text = "U";
- else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
- prop_text_in.text = "WF";
- else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
- prop_text_in.text = "WC";
- else if(process_in->state->s == LTTV_STATE_EXIT)
- prop_text_in.text = "E";
- else if(process_in->state->s == LTTV_STATE_WAIT)
- prop_text_in.text = "W";
- else if(process_in->state->s == LTTV_STATE_RUN)
- prop_text_in.text = "R";
- else
- prop_text_in.text = "U";
-
- draw_text((void*)&prop_text_in, (void*)draw_context_in);
-
- draw_context_in->current->middle->y = y_in+height/2;
- draw_context_in->current->status = process_in->state->s;
-
- /* for pid_in : remove previous, Prev = current, new current (default) */
- g_free(draw_context_in->previous->modify_under);
- g_free(draw_context_in->previous->modify_middle);
- g_free(draw_context_in->previous->modify_over);
- g_free(draw_context_in->previous->under);
- g_free(draw_context_in->previous->middle);
- g_free(draw_context_in->previous->over);
- g_free(draw_context_in->previous);
-
- draw_context_in->previous = draw_context_in->current;
-
- draw_context_in->current = g_new(DrawInfo,1);
- draw_context_in->current->over = g_new(ItemInfo,1);
- draw_context_in->current->over->x = -1;
- draw_context_in->current->over->y = -1;
- draw_context_in->current->middle = g_new(ItemInfo,1);
- draw_context_in->current->middle->x = -1;
- draw_context_in->current->middle->y = -1;
- draw_context_in->current->under = g_new(ItemInfo,1);
- draw_context_in->current->under->x = -1;
- draw_context_in->current->under->y = -1;
- draw_context_in->current->modify_over = g_new(ItemInfo,1);
- draw_context_in->current->modify_over->x = -1;
- draw_context_in->current->modify_over->y = -1;
- draw_context_in->current->modify_middle = g_new(ItemInfo,1);
- draw_context_in->current->modify_middle->x = -1;
- draw_context_in->current->modify_middle->y = -1;
- draw_context_in->current->modify_under = g_new(ItemInfo,1);
- draw_context_in->current->modify_under->x = -1;
- draw_context_in->current->modify_under->y = -1;
- draw_context_in->current->status = LTTV_STATE_UNNAMED;
-
+ guint pid = process->pid;
+
+ /* Well, the process_out existed : we must get it in the process hash
+ * or add it, and draw its items.
+ */
+ /* Add process to process list (if not present) */
+ guint pl_height = 0;
+ HashedProcessData *hashed_process_data = NULL;
+ ProcessList *process_list = control_flow_data->process_list;
+ LttTime birth = process->creation_time;
+
+ if(likely(process_list->current_hash_data[cpu] != NULL)) {
+ hashed_process_data = process_list->current_hash_data[cpu];
+ } else {
+ hashed_process_data = processlist_get_process_data(process_list,
+ pid,
+ process->cpu,
+ &birth,
+ tfc->t_context->index);
+ if(unlikely(hashed_process_data == NULL))
+ {
+ g_assert(pid == 0 || pid != process->ppid);
+ ProcessInfo *process_info;
+ /* Process not present */
+ Drawing_t *drawing = control_flow_data->drawing;
+ processlist_add(process_list,
+ drawing,
+ pid,
+ process->cpu,
+ process->ppid,
+ &birth,
+ tfc->t_context->index,
+ process->name,
+ &pl_height,
+ &process_info,
+ &hashed_process_data);
+ gtk_widget_set_size_request(drawing->drawing_area,
+ -1,
+ pl_height);
+ gtk_widget_queue_draw(drawing->drawing_area);
+ }
+ /* Set the current process */
+ process_list->current_hash_data[process->cpu] =
+ hashed_process_data;