From c4e6f4dcd943f5fc42a6f903c2ca336a343a4624 Mon Sep 17 00:00:00 2001 From: pmf Date: Tue, 31 Jul 2007 19:46:12 +0000 Subject: [PATCH] continue work on resourceview git-svn-id: http://ltt.polymtl.ca/svn@2556 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/configure.in | 1 + .../lttv/modules/gui/resourceview/Makefile.am | 4 +- .../modules/gui/resourceview/eventhooks.c | 18 +- .../modules/gui/resourceview/processlist.c | 335 +++++++++++------- .../modules/gui/resourceview/processlist.h | 31 +- 5 files changed, 225 insertions(+), 164 deletions(-) diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index e815613e..a8a61367 100644 --- a/ltt/branches/poly/configure.in +++ b/ltt/branches/poly/configure.in @@ -129,6 +129,7 @@ AC_CONFIG_FILES([Makefile lttv/modules/gui/histogram/Makefile lttv/modules/gui/filter/Makefile lttv/modules/gui/tracecontrol/Makefile + lttv/modules/gui/resourceview/Makefile ltt/Makefile doc/Makefile doc/developer/Makefile diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/Makefile.am b/ltt/branches/poly/lttv/modules/gui/resourceview/Makefile.am index d70b838e..09645a04 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/Makefile.am @@ -30,8 +30,8 @@ LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -ll libdir = ${lttvplugindir} lib_LTLIBRARIES = libresourceview.la -libguicontrolflow_la_LDFLAGS = -module -avoid-version -libguicontrolflow_la_SOURCES = module.c eventhooks.c cfv.c processlist.c drawing.c drawitem.c lttv_plugin_cfv.c +libresourceview_la_LDFLAGS = -module -avoid-version +libresourceview_la_SOURCES = module.c eventhooks.c cfv.c processlist.c drawing.c drawitem.c lttv_plugin_cfv.c noinst_HEADERS = eventhooks.h cfv.h processlist.h drawing.h drawitem.h lttv_plugin_cfv.h diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c index e87f7edb..953a9289 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c @@ -366,6 +366,8 @@ int before_schedchange_hook(void *hook_data, void *call_data) pid_out = ltt_event_get_long_unsigned(e, thf->f1); pid_in = ltt_event_get_long_unsigned(e, thf->f2); } + + g_debug("a"); tfc->target_pid = pid_out; if(!filter || !filter->head || @@ -406,16 +408,16 @@ int before_schedchange_hook(void *hook_data, void *call_data) /* Process not present */ ProcessInfo *process_info; Drawing_t *drawing = control_flow_data->drawing; - processlist_add(process_list, + resourcelist_add(process_list, drawing, - pid_out, - process->tgid, - process->cpu, - process->ppid, - &birth, - trace_num, +// pid_out, +// process->tgid, +// process->cpu, +// process->ppid, +// &birth, +// trace_num, process->name, - process->brand, +// process->brand, &pl_height, &process_info, &hashed_process_data); diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.c b/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.c index 04be3d21..63bf3435 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.c @@ -249,9 +249,6 @@ static void copy_pixmap_region_each(ProcessInfo *key, cp->width, cp->height); } - - - void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest, GdkGC *gc, GdkDrawable *src, gint xsrc, gint ysrc, @@ -331,18 +328,8 @@ void copy_pixmap_to_screen(ProcessList *process_list, width, cell_height); } - - } - - - - - - - - ProcessList *processlist_construct(void) { GtkTreeViewColumn *column; @@ -422,7 +409,7 @@ ProcessList *processlist_construct(void) process_list->cell_height += vertical_separator; - column = gtk_tree_view_column_new_with_attributes ( "Process", + column = gtk_tree_view_column_new_with_attributes ( "Resource", renderer, "text", PROCESS_COLUMN, @@ -434,73 +421,73 @@ ProcessList *processlist_construct(void) process_list->button = column->button; - column = gtk_tree_view_column_new_with_attributes ( "Brand", - renderer, - "text", - BRAND_COLUMN, - NULL); - gtk_tree_view_column_set_alignment (column, 0.0); - gtk_tree_view_column_set_fixed_width (column, 45); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "PID", - renderer, - "text", - PID_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "TGID", - renderer, - "text", - TGID_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "PPID", - renderer, - "text", - PPID_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "CPU", - renderer, - "text", - CPU_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "Birth sec", - renderer, - "text", - BIRTH_S_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - //gtk_tree_view_column_set_visible(column, 0); - // - column = gtk_tree_view_column_new_with_attributes ( "Birth nsec", - renderer, - "text", - BIRTH_NS_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); - - column = gtk_tree_view_column_new_with_attributes ( "TRACE", - renderer, - "text", - TRACE_COLUMN, - NULL); - gtk_tree_view_append_column ( - GTK_TREE_VIEW (process_list->process_list_widget), column); +// column = gtk_tree_view_column_new_with_attributes ( "Brand", +// renderer, +// "text", +// BRAND_COLUMN, +// NULL); +// gtk_tree_view_column_set_alignment (column, 0.0); +// gtk_tree_view_column_set_fixed_width (column, 45); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "PID", +// renderer, +// "text", +// PID_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "TGID", +// renderer, +// "text", +// TGID_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "PPID", +// renderer, +// "text", +// PPID_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "CPU", +// renderer, +// "text", +// CPU_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "Birth sec", +// renderer, +// "text", +// BIRTH_S_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// //gtk_tree_view_column_set_visible(column, 0); +// // +// column = gtk_tree_view_column_new_with_attributes ( "Birth nsec", +// renderer, +// "text", +// BIRTH_NS_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); +// +// column = gtk_tree_view_column_new_with_attributes ( "TRACE", +// renderer, +// "text", +// TRACE_COLUMN, +// NULL); +// gtk_tree_view_append_column ( +// GTK_TREE_VIEW (process_list->process_list_widget), column); //gtk_tree_view_column_set_visible(column, 0); @@ -611,52 +598,58 @@ void processlist_set_ppid(ProcessList *process_list, -1); } - -int processlist_add( ProcessList *process_list, +int resourcelist_add( ProcessList *process_list, Drawing_t *drawing, - guint pid, - guint tgid, - guint cpu, - guint ppid, - LttTime *birth, - guint trace_num, +// guint pid, +// guint tgid, +// guint cpu, +// guint ppid, +// LttTime *birth, +// guint trace_num, GQuark name, - GQuark brand, +// GQuark brand, guint *height, - ProcessInfo **pm_process_info, - HashedProcessData **pm_hashed_process_data) + ResourceInfo **pm_process_info, + ProcessInfo + ResourceProcessData **pm_hashed_process_data) { - ProcessInfo *Process_Info = g_new(ProcessInfo, 1); - HashedProcessData *hashed_process_data = g_new(HashedProcessData, 1); - *pm_hashed_process_data = hashed_process_data; - *pm_process_info = Process_Info; + ResourceInfo *Process_Info = g_new(ProcessInfo, 1); + HashedResourceData *hashed_resource_data = g_new(HashedProcessData, 1); + *pm_hashed_resource_data = hashed_resource_data; + *pm_resource_info = Resource_Info; - Process_Info->pid = pid; - Process_Info->tgid = tgid; - if(pid == 0) - Process_Info->cpu = cpu; - else - Process_Info->cpu = 0; - Process_Info->ppid = ppid; - Process_Info->birth = *birth; - Process_Info->trace_num = trace_num; +// Process_Info->pid = pid; +// Process_Info->tgid = tgid; +// if(pid == 0) +// Process_Info->cpu = cpu; +// else +// Process_Info->cpu = 0; +// Process_Info->ppid = ppid; +// Process_Info->birth = *birth; +// Process_Info->trace_num = trace_num; /* When we create it from before state update, we are sure that the * last event occured before the beginning of the global area. * * If it is created after state update, this value (0) will be * overriden by the new state before anything is drawn. + * + * There are 3 potential lines for the each process: one in the middle, + * one under it and one over it. The {over,middle,under} fields tell us + * the x pixel on the pixmap where we are. The _used fields tell us + * whether that pixel was used. The _marked field tells us if we marked a + * conflict point. */ - hashed_process_data->x.over = 0; - hashed_process_data->x.over_used = FALSE; - hashed_process_data->x.over_marked = FALSE; - hashed_process_data->x.middle = 0; - hashed_process_data->x.middle_used = FALSE; - hashed_process_data->x.middle_marked = FALSE; - hashed_process_data->x.under = 0; - hashed_process_data->x.under_used = FALSE; - hashed_process_data->x.under_marked = FALSE; - hashed_process_data->next_good_time = ltt_time_zero; + hashed_resource_data->x.over = 0; + hashed_resource_data->x.over_used = FALSE; + hashed_resource_data->x.over_marked = FALSE; + hashed_resource_data->x.middle = 0; // last + hashed_resource_data->x.middle_used = FALSE; + hashed_resource_data->x.middle_marked = FALSE; + hashed_resource_data->x.under = 0; + hashed_resource_data->x.under_used = FALSE; + hashed_resource_data->x.under_marked = FALSE; + hashed_resource_data->next_good_time = ltt_time_zero; /* Add a new row to the model */ gtk_list_store_append ( process_list->list_store, @@ -664,24 +657,13 @@ int processlist_add( ProcessList *process_list, gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter, PROCESS_COLUMN, g_quark_to_string(name), - BRAND_COLUMN, g_quark_to_string(brand), - PID_COLUMN, pid, - TGID_COLUMN, tgid, - PPID_COLUMN, ppid, - CPU_COLUMN, cpu, - BIRTH_S_COLUMN, birth->tv_sec, - BIRTH_NS_COLUMN, birth->tv_nsec, - TRACE_COLUMN, trace_num, -1); - //gtk_tree_view_set_model(GTK_TREE_VIEW(process_list->process_list_widget), - // GTK_TREE_MODEL(process_list->list_store)); - //gtk_container_resize_children(GTK_CONTAINER(process_list->process_list_widget)); g_hash_table_insert(process_list->process_hash, (gpointer)Process_Info, (gpointer)hashed_process_data); - process_list->number_of_process++; + process_list->number_of_process++; // of resources hashed_process_data->height = process_list->cell_height; @@ -695,7 +677,7 @@ int processlist_add( ProcessList *process_list, hashed_process_data->height, -1); - // Clear the image + // Clear the image with black background gdk_draw_rectangle (hashed_process_data->pixmap, drawing->drawing_area->style->black_gc, TRUE, @@ -705,9 +687,104 @@ int processlist_add( ProcessList *process_list, update_index_to_pixmap(process_list); - return 0; } +//int processlist_add( ProcessList *process_list, +// Drawing_t *drawing, +// guint pid, +// guint tgid, +// guint cpu, +// guint ppid, +// LttTime *birth, +// guint trace_num, +// GQuark name, +// GQuark brand, +// guint *height, +// ProcessInfo **pm_process_info, +// HashedProcessData **pm_hashed_process_data) +//{ +// ProcessInfo *Process_Info = g_new(ProcessInfo, 1); +// HashedProcessData *hashed_process_data = g_new(HashedProcessData, 1); +// *pm_hashed_process_data = hashed_process_data; +// *pm_process_info = Process_Info; +// +// Process_Info->pid = pid; +// Process_Info->tgid = tgid; +// if(pid == 0) +// Process_Info->cpu = cpu; +// else +// Process_Info->cpu = 0; +// Process_Info->ppid = ppid; +// Process_Info->birth = *birth; +// Process_Info->trace_num = trace_num; +// +// /* When we create it from before state update, we are sure that the +// * last event occured before the beginning of the global area. +// * +// * If it is created after state update, this value (0) will be +// * overriden by the new state before anything is drawn. +// */ +// hashed_process_data->x.over = 0; +// hashed_process_data->x.over_used = FALSE; +// hashed_process_data->x.over_marked = FALSE; +// hashed_process_data->x.middle = 0; +// hashed_process_data->x.middle_used = FALSE; +// hashed_process_data->x.middle_marked = FALSE; +// hashed_process_data->x.under = 0; +// hashed_process_data->x.under_used = FALSE; +// hashed_process_data->x.under_marked = FALSE; +// hashed_process_data->next_good_time = ltt_time_zero; +// +// /* Add a new row to the model */ +// gtk_list_store_append ( process_list->list_store, +// &hashed_process_data->y_iter); +// +// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter, +// PROCESS_COLUMN, g_quark_to_string(name), +// BRAND_COLUMN, g_quark_to_string(brand), +// PID_COLUMN, pid, +// TGID_COLUMN, tgid, +// PPID_COLUMN, ppid, +// CPU_COLUMN, cpu, +// BIRTH_S_COLUMN, birth->tv_sec, +// BIRTH_NS_COLUMN, birth->tv_nsec, +// TRACE_COLUMN, trace_num, +// -1); +// //gtk_tree_view_set_model(GTK_TREE_VIEW(process_list->process_list_widget), +// // GTK_TREE_MODEL(process_list->list_store)); +// //gtk_container_resize_children(GTK_CONTAINER(process_list->process_list_widget)); +// +// g_hash_table_insert(process_list->process_hash, +// (gpointer)Process_Info, +// (gpointer)hashed_process_data); +// +// process_list->number_of_process++; +// +// hashed_process_data->height = process_list->cell_height; +// +// g_assert(hashed_process_data->height != 0); +// +// *height = hashed_process_data->height * process_list->number_of_process; +// +// hashed_process_data->pixmap = +// gdk_pixmap_new(drawing->drawing_area->window, +// drawing->alloc_width, +// hashed_process_data->height, +// -1); +// +// // Clear the image +// gdk_draw_rectangle (hashed_process_data->pixmap, +// drawing->drawing_area->style->black_gc, +// TRUE, +// 0, 0, +// drawing->alloc_width, +// hashed_process_data->height); +// +// update_index_to_pixmap(process_list); +// +// +// return 0; +//} int processlist_remove( ProcessList *process_list, guint pid, diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h b/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h index d9484603..1e38afc1 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h @@ -16,8 +16,6 @@ * MA 02111-1307, USA. */ - - #ifndef _PROCESS_LIST_H #define _PROCESS_LIST_H @@ -45,33 +43,16 @@ /* Enumeration of the columns */ enum { - PROCESS_COLUMN, - BRAND_COLUMN, - PID_COLUMN, - TGID_COLUMN, - PPID_COLUMN, - CPU_COLUMN, - BIRTH_S_COLUMN, - BIRTH_NS_COLUMN, - TRACE_COLUMN, + NAME_COLUMN, N_COLUMNS }; -typedef struct _ProcessInfo { - - guint pid; - guint tgid; - guint cpu; - guint ppid; - LttTime birth; - guint trace_num; - - // gint height_cache; - -} ProcessInfo; +typedef struct _ResourceInfo { + guint name; +} ResourceInfo; -typedef struct _HashedProcessData { +typedef struct _HashedResourceData { GdkPixmap *pixmap; // Pixmap slice containing drawing buffer for the PID gint height; // height of the pixmap @@ -93,7 +74,7 @@ typedef struct _HashedProcessData { LttTime next_good_time; /* precalculate the next time where the next pixel is.*/ -} HashedProcessData; +} HashedResourceData; struct _ProcessList { -- 2.34.1