&height,
&hashed_process_data) == 1)
{
+ g_assert(!(process->pid == 432 &&
+ ltt_time_compare(process->creation_time,
+ ltt_time_zero)==0));
+
+ g_assert(!(process->pid == 432 &&
+ process->creation_time.tv_nsec == 47797905));
/* Process not present */
processlist_add(process_list,
pid_out,
&height,
&hashed_process_data_in) == 1)
{
+ g_assert(!(process_in->pid == 432 &&
+ ltt_time_compare(process_in->creation_time,
+ ltt_time_zero)==0));
+
+ g_assert(!(process_in->pid == 432 &&
+ process_in->creation_time.tv_nsec == 47797905));
+
/* Process not present */
processlist_add(process_list,
pid_in,
} ClosureData;
-/* find_process
- * Input : A trace and a PID.
- *
- * - For each CPU of the trace
- * - Search in trace states by PID and CPU key
- * - If no ProcessState found, return NULL.
- */
-static LttvProcessState *find_process(LttvTraceState *tstate, guint pid)
-{
- guint cpu_num = ltt_trace_per_cpu_tracefile_number(tstate->parent.t);
- GQuark cpu_name;
- guint i;
-
- LttvProcessState *real_state = NULL;
-
- for(i=0;i<cpu_num;i++) {
- cpu_name = ((LttvTracefileState*)tstate->parent.tracefiles[i])->cpu_name;
- LttvProcessState *state = lttv_state_find_process_from_trace(tstate,
- cpu_name,
- pid);
- if(state != NULL) {
- real_state = state;
- break;
- }
- }
- return real_state;
-}
-
-
void draw_closure(gpointer key, gpointer value, gpointer user_data)
{
ProcessInfo *process_info = (ProcessInfo*)key;
* be added after the state update. */
g_assert(lttv_traceset_number(tsc->ts) > 0);
- LttvTraceState *trace_state =
- (LttvTraceState*)tsc->traces[process_info->trace_num];
+ /* tracefiles[0] is ok here, because we draw for every PID, and
+ * assume CPU 0 for PID 0 //FIXME */
+ LttvTracefileState *tfs =
+ (LttvTracefileState*)tsc->traces[process_info->trace_num]->tracefiles[0];
LttvProcessState *process;
- process = find_process(trace_state, process_info->pid);
+ process = lttv_state_find_process(tfs,
+ process_info->pid);
if(process != NULL) {
g_info("GUI ControlFlow Viewer init()");
/* Register the toolbar insert button and menu entry*/
- lttvwindow_register_constructor("/",
+ lttvwindow_register_constructor("guicontrolflow",
+ "/",
"Insert Control Flow Viewer",
hGuiControlFlowInsert_xpm,
"Insert Control Flow Viewer",
*/
static void init() {
- lttvwindow_register_constructor("/",
+ lttvwindow_register_constructor("guievents",
+ "/",
"Insert Event Viewer",
hGuiEventsInsert_xpm,
"Insert Event Viewer",
}
LttvTraceset *traceset = new_tab->traceset_info->traceset;
SetTraceset(new_tab, traceset);
+
+ /* Insert default viewers */
+ {
+ LttvAttributeType type;
+ LttvAttributeName name;
+ LttvAttributeValue value;
+ LttvAttribute *attribute;
+
+ LttvIAttribute *attributes_global =
+ LTTV_IATTRIBUTE(lttv_global_attributes());
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS)));
+
+ name = g_quark_from_string("guievents");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
+
+ name = g_quark_from_string("guicontrolflow");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
+
+ name = g_quark_from_string("guistatistics");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
+
+ }
}
g_printf("There are now : %d windows\n",g_slist_length(g_main_window_list));
int i, nb, ref_count;
LttvTrace * trace;
- g_object_free(tab->tooltips);
+ g_object_unref(tab->tooltips);
if(tab->attributes)
g_object_unref(tab->attributes);
LttvTraceInfo LTTV_TRACES,
LTTV_COMPUTATION,
+ LTTV_VIEWER_CONSTRUCTORS,
LTTV_REQUESTS_QUEUE,
LTTV_REQUESTS_CURRENT,
LTTV_NOTIFY_QUEUE,
LTTV_TRACES = g_quark_from_string("traces");
LTTV_COMPUTATION = g_quark_from_string("computation");
+ LTTV_VIEWER_CONSTRUCTORS = g_quark_from_string("viewer_constructors");
LTTV_REQUESTS_QUEUE = g_quark_from_string("requests_queue");
LTTV_REQUESTS_CURRENT = g_quark_from_string("requests_current");
LTTV_NOTIFY_QUEUE = g_quark_from_string("notify_queue");
*
* It should be called by init function of the module.
*
+ * @param name name of the viewer
* @param menu_path path of the menu item.
* @param menu_text text of the menu item.
* @param pixmap Image shown on the toolbar item.
*/
void lttvwindow_register_constructor
- (char * menu_path,
+ (char * name,
+ char * menu_path,
char * menu_text,
char ** pixmap,
char * tooltip,
LttvMenuClosure menu_c;
LttvAttributeValue value;
+ if(view_constructor == NULL) return;
+
if(pixmap != NULL) {
g_assert(lttv_iattribute_find_by_path(attributes_global,
"viewers/toolbar", LTTV_POINTER, &value));
(gpointer)add_menu_constructor,
&menu_c);
}
+ {
+ LttvAttribute *attribute;
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS)));
+
+ g_assert(lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(attribute),
+ name, LTTV_POINTER, &value));
+
+ *(value.v_pointer) = view_constructor;
+
+ }
}
view_constructor);
lttv_menus_remove(menu, view_constructor);
}
+
+ {
+ LttvAttribute *attribute;
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS)));
+
+ guint num = lttv_iattribute_get_number(LTTV_IATTRIBUTE(attribute));
+ guint i;
+ LttvAttributeName name;
+ LttvAttributeValue value;
+ LttvAttributeType type;
+
+ for(i=0;i<num;i++) {
+ type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), i, &name, &value);
+ g_assert(type == LTTV_POINTER);
+ if(*(value.v_pointer) == view_constructor) {
+ lttv_iattribute_remove(LTTV_IATTRIBUTE(attribute), i);
+ break;
+ }
+ }
+ }
}
/* Module Related API */
+/* GQuark containing constructors of viewers in global attributes */
+extern GQuark LTTV_VIEWER_CONSTRUCTORS;
/* constructor a the viewer */
typedef GtkWidget* (*lttvwindow_viewer_constructor)(Tab *tab);
* window.
*
* It should be called by init function of the module.
- *
+ *
+ * @param name name of the viewer : mainly used as tag for constructor
* @param menu_path path of the menu item. NULL : no menu entry.
* @param menu_text text of the menu item.
* @param pixmap Image shown on the toolbar item. NULL : no button.
*/
void lttvwindow_register_constructor
- (char * menu_path,
+ (char * name,
+ char * menu_path,
char * menu_text,
char ** pixmap,
char * tooltip,
*/
#include <glib.h>
+#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash,
g_str_equal,
statistic_destroy_hash_key,
- statistic_destroy_hash_data);
+ NULL);
statistic_viewer_data->hpaned_v = gtk_hpaned_new();
statistic_viewer_data->store_m = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING);
g_free(key);
}
-void statistic_destroy_hash_data(gpointer data)
-{
- // g_free(data);
-}
-
+#ifdef DEBUG
#include <stdio.h>
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
+#endif //DEBUG
void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
{
for(i = 0 ; i < nb ; i++) {
tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]);
desc = ltt_trace_system_description(tcs->parent.parent.t);
- sprintf(trace_str, "Trace on system %s at time %d secs",
+ LttTime start_time = ltt_trace_system_description_trace_start_time(desc);
+ sprintf(trace_str, "Trace on system %s at time %lu.%09lu",
ltt_trace_system_description_node_name(desc),
- (ltt_trace_system_description_trace_start_time(desc)).tv_sec);
+ start_time.tv_sec,
+ start_time.tv_nsec);
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter,NAME_COLUMN,trace_str,-1);
LttvAttribute* stats, GtkTextBuffer* buf)
{
int i, nb , flag;
- LttvAttribute *subtree;
LttvAttributeName name;
LttvAttributeValue value;
LttvAttributeType type;
sprintf(type_value, " : %f\n", *value.v_double);
break;
case LTTV_TIME:
- sprintf(type_value, " : %10u.%09u\n", value.v_time->tv_sec,
+ sprintf(type_value, " : %10lu.%09lu\n", value.v_time->tv_sec,
value.v_time->tv_nsec);
break;
case LTTV_POINTER:
*/
static void init() {
- lttvwindow_register_constructor("/",
+ lttvwindow_register_constructor("guistatistics",
+ "/",
"Insert Statistic Viewer",
hGuiStatisticInsert_xpm,
"Insert Statistic Viewer",
* everything that has been registered in the gtkTraceSet API.
*/
static void destroy() {
- int i;
g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL );
g_slist_free(g_statistic_viewer_data_list);