X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fresourceview%2Fprocesslist.h;h=24e2794197c9c903eaf0016c0d7a718bfe9eeb7a;hb=0305fe774206ec12a98378be3cf891446b1b901c;hp=d94846030ea798d57aece063eb7cec4d5dc237b7;hpb=9e01e6d4aa891aa2900227503bde6e7dd9ae65a1;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h b/ltt/branches/poly/lttv/modules/gui/resourceview/processlist.h index d9484603..24e27941 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 @@ -27,6 +25,7 @@ #include #include "drawitem.h" +#include "cfv.h" /* The process list * @@ -41,37 +40,38 @@ * */ +/* Unique identifiers for resource types */ +#define RV_RESOURCE_MACHINE 0 +#define RV_RESOURCE_CPU 1 +#define RV_RESOURCE_IRQ 2 +#define RV_RESOURCE_SOFT_IRQ 3 +#define RV_RESOURCE_BDEV 4 +#define RV_RESOURCE_COUNT 5 /* 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, + DATA_COLUMN, N_COLUMNS }; - -typedef struct _ProcessInfo { - - guint pid; - guint tgid; - guint cpu; - guint ppid; - LttTime birth; +/* +typedef struct _ResourceInfo { + GQuark name; guint trace_num; - - // gint height_cache; - -} ProcessInfo; - -typedef struct _HashedProcessData { + guint type; + guint64 id; +} ResourceInfo; +*/ + +typedef struct _ResourceUniqueNumeric { + guint trace_num; + guint id; +} ResourceUniqueNumeric; + +typedef struct _HashedResourceData { + guint type; GdkPixmap *pixmap; // Pixmap slice containing drawing buffer for the PID gint height; // height of the pixmap @@ -93,32 +93,49 @@ typedef struct _HashedProcessData { LttTime next_good_time; /* precalculate the next time where the next pixel is.*/ -} HashedProcessData; +} HashedResourceData; +struct _ResourceType { + /* functions for the hash table below */ + guint (*hashfunc)(gconstpointer); + gboolean (*hashequalfunc)(gconstpointer,gconstpointer); + /* a hashtable containing the data of each resource of this type */ + GHashTable *hash_table; +}; +typedef struct _ResourceType ResourceType; + struct _ProcessList { GtkWidget *process_list_widget; - GtkListStore *list_store; + GtkTreeStore *list_store; GtkWidget *button; /* one button of the tree view */ GtkCellRenderer *renderer; /* A hash table by PID to speed up process position find in the list */ - GHashTable *process_hash; +// GHashTable *process_hash; guint number_of_process; gint cell_height; /* Current process pointer, one per cpu, one per trace */ - HashedProcessData ***current_hash_data; + HashedResourceData ***current_hash_data; /* Array containing index -> pixmap correspondance. Must be updated * every time the process list is reordered, process added or removed */ GPtrArray * index_to_pixmap; + ResourceType restypes[RV_RESOURCE_COUNT]; }; +typedef struct _UpdateIndexPixmapArg { + ProcessList *process_list; + guint count; +} UpdateIndexPixmapArg; +#ifndef TYPE_PROCESSLIST_DEFINED +#define TYPE_PROCESSLIST_DEFINED typedef struct _ProcessList ProcessList; +#endif //TYPE_PROCESSLIST_DEFINED #ifndef TYPE_DRAWING_T_DEFINED @@ -134,11 +151,10 @@ void processlist_clear(ProcessList *process_list); // out : success (0) and height /* CPU num is only used for PID 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 **process_info, - HashedProcessData **hashed_process_data); +//int resourcelist_add( ProcessList *process_list, Drawing_t *drawing, guint trace_num, +// GQuark name, guint type, guint id, guint *height, ResourceInfo **pm_resource_info, +// HashedResourceData **pm_hashed_resource_data, GQuark parent); + // out : success (0) and height int processlist_remove(ProcessList *process_list, guint pid, guint cpu, LttTime *birth, guint trace_num); @@ -146,19 +162,19 @@ int processlist_remove(ProcessList *process_list, guint pid, guint cpu, /* Set the name of a process */ void processlist_set_name(ProcessList *process_list, GQuark name, - HashedProcessData *hashed_process_data); + HashedResourceData *hashed_process_data); void processlist_set_brand(ProcessList *process_list, GQuark brand, - HashedProcessData *hashed_process_data); + HashedResourceData *hashed_process_data); /* Set the ppid of a process */ void processlist_set_tgid(ProcessList *process_list, guint tgid, - HashedProcessData *hashed_process_data); + HashedResourceData *hashed_process_data); void processlist_set_ppid(ProcessList *process_list, guint ppid, - HashedProcessData *hashed_process_data); + HashedResourceData *hashed_process_data); /* Synchronize the list at the left and the drawing */ @@ -185,7 +201,6 @@ void copy_pixmap_to_screen(ProcessList *process_list, gint x, gint y, gint width, gint height); - static inline gint get_cell_height(GtkTreeView *TreeView) { gint height; @@ -208,28 +223,29 @@ static inline guint processlist_get_height(ProcessList *process_list) } -static inline HashedProcessData *processlist_get_process_data( - ProcessList *process_list, - guint pid, guint cpu, LttTime *birth, guint trace_num) -{ - ProcessInfo process_info; - - process_info.pid = pid; - if(pid == 0) - process_info.cpu = cpu; - else - process_info.cpu = ANY_CPU; - process_info.birth = *birth; - process_info.trace_num = trace_num; - - return (HashedProcessData*)g_hash_table_lookup( - process_list->process_hash, - &process_info); -} - +//static inline HashedResourceData *processlist_get_process_data( +// ProcessList *process_list, GQuark resource_name, guint trace_num) +//{ +// ResourceInfo resource_info; +// +//// process_info.pid = pid; +//// if(pid == 0) +//// process_info.cpu = cpu; +//// else +//// process_info.cpu = ANY_CPU; +//// process_info.birth = *birth; +//// process_info.trace_num = trace_num; +// resource_info.name = resource_name; +// resource_info.trace_num = trace_num; +// +// return (HashedResourceData*)g_hash_table_lookup( +// process_list->process_hash, +// &resource_info); +//} +// static inline gint processlist_get_pixels_from_data( ProcessList *process_list, - HashedProcessData *hashed_process_data, + HashedResourceData *hashed_process_data, guint *y, guint *height) { @@ -249,23 +265,35 @@ static inline gint processlist_get_pixels_from_data( ProcessList *process_list, } static inline guint processlist_get_index_from_data(ProcessList *process_list, - HashedProcessData *hashed_process_data) + HashedResourceData *hashed_process_data) { gint *path_indices; GtkTreePath *tree_path; guint ret; + gint depth; tree_path = gtk_tree_model_get_path((GtkTreeModel*)process_list->list_store, &hashed_process_data->y_iter); path_indices = gtk_tree_path_get_indices (tree_path); + depth = gtk_tree_path_get_depth(tree_path); +// ret = path_indices[1]+path_indices[0]+1; ret = path_indices[0]; + if(depth>1) + ret+= 1+path_indices[1]; gtk_tree_path_free(tree_path); return ret; } +/* Return the hash table used to store the data of each resource of a given resource type */ + +static inline GHashTable *resourcelist_get_resource_hash_table(ControlFlowData *resourceview_data, guint type) +{ + return resourceview_data->process_list->restypes[type].hash_table; +} + #endif // _PROCESS_LIST_H