typedef struct _LttvTracesetSelector LttvTracesetSelector;
typedef struct _LttvTraceSelector LttvTraceSelector;
typedef struct _LttvTracefileSelector LttvTracefileSelector;
+typedef struct _LttvEventtypeSelector LttvEventtypeSelector;
LttvTracesetSelector *lttv_traceset_selector_new(char * name);
LttvTraceSelector *lttv_trace_selector_new(LttTrace *t);
LttvTracefileSelector *lttv_tracefile_selector_new(LttTracefile *t);
+LttvEventtypeSelector *lttv_eventtype_selector_new(LttEventType * et);
void lttv_traceset_selector_destroy(LttvTracesetSelector *s);
void lttv_trace_selector_destroy(LttvTraceSelector *t);
void lttv_tracefile_selector_destroy(LttvTracefileSelector *t);
+void lttv_eventtype_selector_destroy(LttvEventtypeSelector *t);
-void lttv_traceset_selector_add(LttvTracesetSelector *s, LttvTraceSelector *t);
-unsigned lttv_traceset_selector_number(LttvTracesetSelector *s);
-LttvTraceSelector *lttv_traceset_selector_get(LttvTracesetSelector *s, unsigned i);
-void lttv_traceset_selector_remove(LttvTracesetSelector *s, unsigned i);
+void lttv_traceset_selector_trace_add(LttvTracesetSelector *s,
+ LttvTraceSelector *t);
+unsigned lttv_traceset_selector_trace_number(LttvTracesetSelector *s);
+LttvTraceSelector *lttv_traceset_selector_trace_get(LttvTracesetSelector *s,
+ unsigned i);
+void lttv_traceset_selector_trace_remove(LttvTracesetSelector *s,
+ unsigned i);
-void lttv_trace_selector_add(LttvTraceSelector *s, LttvTracefileSelector *t);
-unsigned lttv_trace_selector_number(LttvTraceSelector *s);
-LttvTracefileSelector *lttv_trace_selector_get(LttvTraceSelector *s, unsigned i);
-void lttv_trace_selector_remove(LttvTraceSelector *s, unsigned i);
+void lttv_trace_selector_tracefile_add(LttvTraceSelector *s,
+ LttvTracefileSelector *t);
+unsigned lttv_trace_selector_tracefile_number(LttvTraceSelector *s);
+LttvTracefileSelector *lttv_trace_selector_tracefile_get(LttvTraceSelector *s,
+ unsigned i);
+void lttv_trace_selector_tracefile_remove(LttvTraceSelector *s, unsigned i);
+
+void lttv_trace_selector_eventtype_add(LttvTraceSelector *s,
+ LttvEventtypeSelector *et);
+unsigned lttv_trace_selector_eventtype_number(LttvTraceSelector *s);
+LttvEventtypeSelector *lttv_trace_selector_eventtype_get(LttvTraceSelector *s,
+ unsigned i);
+void lttv_trace_selector_eventtype_remove(LttvTraceSelector *s, unsigned i);
+
+
+void lttv_tracefile_selector_eventtype_add(LttvTracefileSelector *s,
+ LttvEventtypeSelector *et);
+unsigned lttv_tracefile_selector_eventtype_number(LttvTracefileSelector *s);
+LttvEventtypeSelector *lttv_tracefile_selector_eventtype_get(LttvTracefileSelector *s,
+ unsigned i);
+void lttv_tracefile_selector_eventtype_remove(LttvTracefileSelector *s, unsigned i);
+
void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g);
void lttv_tracefile_selector_set_selected(LttvTracefileSelector *s, gboolean g);
+void lttv_eventtype_selector_set_selected(LttvEventtypeSelector *s, gboolean g);
gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s);
gboolean lttv_tracefile_selector_get_selected(LttvTracefileSelector *s);
+gboolean lttv_eventtype_selector_get_selected(LttvEventtypeSelector *s);
+char * lttv_traceset_selector_get_name(LttvTracesetSelector *s);
char * lttv_trace_selector_get_name(LttvTraceSelector *s);
char * lttv_tracefile_selector_get_name(LttvTracefileSelector *s);
+char * lttv_eventtype_selector_get_name(LttvEventtypeSelector *s);
+
+LttvEventtypeSelector * lttv_eventtype_selector_clone(LttvEventtypeSelector * s);
+void lttv_eventtype_selector_copy(LttvTraceSelector *s, LttvTracefileSelector *d);
+
#endif // LTTV_FILTER_H
#include <lttv/iattribute.h>
#include <lttv/lttvfilter.h>
#include <ltt/trace.h>
+#include <ltt/facility.h>
#define PATH_LENGTH 256
#define DEFAULT_TIME_WIDTH_S 1
LttvTracesetSelector * s;
LttvTraceSelector * trace;
LttvTracefileSelector * tracefile;
- int i, j, nb_trace, nb_tracefile, nb_control, nb_per_cpu;
+ LttvEventtypeSelector * eventtype;
+ int i, j, k, m;
+ int nb_trace, nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
LttvTrace * trace_v;
LttTrace * t;
LttTracefile *tf;
+ LttFacility * fac;
+ LttEventType * et;
s = lttv_traceset_selector_new(lttv_traceset_name(traceset));
nb_trace = lttv_traceset_number(traceset);
trace_v = lttv_traceset_get(traceset, i);
t = lttv_trace(trace_v);
trace = lttv_trace_selector_new(t);
- lttv_traceset_selector_add(s, trace);
+ lttv_traceset_selector_trace_add(s, trace);
+
+ nb_facility = ltt_trace_facility_number(t);
+ for(k=0;k<nb_facility;k++){
+ fac = ltt_trace_facility_get(t,k);
+ nb_event = (int) ltt_facility_eventtype_number(fac);
+ for(m=0;m<nb_event;m++){
+ et = ltt_facility_eventtype_get(fac,m);
+ eventtype = lttv_eventtype_selector_new(et);
+ lttv_trace_selector_eventtype_add(trace, eventtype);
+ }
+ }
+
nb_control = ltt_trace_control_tracefile_number(t);
nb_per_cpu = ltt_trace_per_cpu_tracefile_number(t);
nb_tracefile = nb_control + nb_per_cpu;
else
tf = ltt_trace_per_cpu_tracefile_get(t, j - nb_control);
tracefile = lttv_tracefile_selector_new(tf);
- lttv_trace_selector_add(trace, tracefile);
+ lttv_trace_selector_tracefile_add(trace, tracefile);
+ lttv_eventtype_selector_copy(trace, tracefile);
}
}
return s;
void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * t)
{
- int j, nb_tracefile, nb_control, nb_per_cpu;
+ int j, k, m, nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
LttvTracesetSelector * s;
LttvTraceSelector * trace;
LttvTracefileSelector * tracefile;
+ LttvEventtypeSelector * eventtype;
LttTracefile * tf;
GtkWidget * w;
+ LttFacility * fac;
+ LttEventType * et;
w = gtk_multi_vpaned_get_first_widget(paned);
while(w){
s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
trace = lttv_trace_selector_new(t);
- lttv_traceset_selector_add(s, trace);
+ lttv_traceset_selector_trace_add(s, trace);
+
+ nb_facility = ltt_trace_facility_number(t);
+ for(k=0;k<nb_facility;k++){
+ fac = ltt_trace_facility_get(t,k);
+ nb_event = (int) ltt_facility_eventtype_number(fac);
+ for(m=0;m<nb_event;m++){
+ et = ltt_facility_eventtype_get(fac,m);
+ eventtype = lttv_eventtype_selector_new(et);
+ lttv_trace_selector_eventtype_add(trace, eventtype);
+ }
+ }
+
nb_control = ltt_trace_control_tracefile_number(t);
nb_per_cpu = ltt_trace_per_cpu_tracefile_number(t);
nb_tracefile = nb_control + nb_per_cpu;
else
tf = ltt_trace_per_cpu_tracefile_get(t, j - nb_control);
tracefile = lttv_tracefile_selector_new(tf);
- lttv_trace_selector_add(trace, tracefile);
+ lttv_trace_selector_tracefile_add(trace, tracefile);
+ lttv_eventtype_selector_copy(trace, tracefile);
}
w = gtk_multi_vpaned_get_next_widget(paned);
w = gtk_multi_vpaned_get_first_widget(paned);
while(w){
s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
- t = lttv_traceset_selector_get(s,i);
- lttv_traceset_selector_remove(s, i);
+ t = lttv_traceset_selector_trace_get(s,i);
+ lttv_traceset_selector_trace_remove(s, i);
lttv_trace_selector_destroy(t);
w = gtk_multi_vpaned_get_next_widget(paned);
}
//unselect the trace from the current viewer
w = gtk_multi_vpaned_get_widget(mw_data->current_tab->multi_vpaned);
s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
- t = lttv_traceset_selector_get(s,i);
+ t = lttv_traceset_selector_trace_get(s,i);
lttv_trace_selector_set_selected(t, FALSE);
//check if other viewers select the trace
w = gtk_multi_vpaned_get_first_widget(mw_data->current_tab->multi_vpaned);
while(w){
s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
- t = lttv_traceset_selector_get(s,i);
+ t = lttv_traceset_selector_trace_get(s,i);
selected = lttv_trace_selector_get_selected(t);
if(selected)break;
w = gtk_multi_vpaned_get_next_widget(mw_data->current_tab->multi_vpaned);
void update_filter(LttvTracesetSelector *s, GtkTreeStore *store )
{
- GtkTreeIter iter, child_iter;
- int i, j;
+ GtkTreeIter iter, child_iter, child_iter1, child_iter2;
+ int i, j, k, nb_eventtype;
LttvTraceSelector * trace;
LttvTracefileSelector * tracefile;
- gboolean value, value1;
+ LttvEventtypeSelector * eventtype;
+ gboolean value, value1, value2;
if(gtk_tree_model_get_iter_first((GtkTreeModel*)store, &iter)){
i = 0;
do{
- trace = lttv_traceset_selector_get(s, i);
+ trace = lttv_traceset_selector_trace_get(s, i);
+ nb_eventtype = lttv_trace_selector_eventtype_number(trace);
gtk_tree_model_get ((GtkTreeModel*)store, &iter, CHECKBOX_COLUMN, &value,-1);
if(value){
j = 0;
if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter, &iter)){
do{
- tracefile = lttv_trace_selector_get(trace, j);
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value1,-1);
- lttv_tracefile_selector_set_selected(tracefile,value1);
+ if(j<1){//eventtype selector for trace
+ gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value2,-1);
+ if(value2){
+ k=0;
+ if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter1, &child_iter)){
+ do{
+ eventtype = lttv_trace_selector_eventtype_get(trace,k);
+ gtk_tree_model_get ((GtkTreeModel*)store, &child_iter1, CHECKBOX_COLUMN, &value2,-1);
+ lttv_eventtype_selector_set_selected(eventtype,value2);
+ k++;
+ }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter1));
+ }
+ }
+ }else{ //tracefile selector
+ tracefile = lttv_trace_selector_tracefile_get(trace, j - 1);
+ gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value1,-1);
+ lttv_tracefile_selector_set_selected(tracefile,value1);
+ if(value1){
+ gtk_tree_model_iter_children((GtkTreeModel*)store, &child_iter1, &child_iter); //eventtype selector
+ gtk_tree_model_get ((GtkTreeModel*)store, &child_iter1, CHECKBOX_COLUMN, &value2,-1);
+ if(value2){
+ k = 0;
+ if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter2, &child_iter1)){
+ do{//eventtype selector for tracefile
+ eventtype = lttv_tracefile_selector_eventtype_get(tracefile,k);
+ gtk_tree_model_get ((GtkTreeModel*)store, &child_iter2, CHECKBOX_COLUMN, &value2,-1);
+ lttv_eventtype_selector_set_selected(eventtype,value2);
+ k++;
+ }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter2));
+ }
+ }
+ }
+ }
j++;
}while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter));
}
GtkWidget * scroll_win;
GtkCellRenderer * renderer;
GtkTreeViewColumn * column;
- GtkTreeIter iter, child_iter;
- int i, j, id, nb_trace, nb_tracefile;
+ GtkTreeIter iter, child_iter, child_iter1, child_iter2;
+ int i, j, k, id, nb_trace, nb_tracefile, nb_eventtype;
LttvTraceSelector * trace;
LttvTracefileSelector * tracefile;
+ LttvEventtypeSelector * eventtype;
char * name;
gboolean checked;
GTK_STOCK_OK,GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL,GTK_RESPONSE_REJECT,
NULL);
- gtk_window_set_default_size((GtkWindow*)dialogue, 300, 100);
+ gtk_window_set_default_size((GtkWindow*)dialogue, 300, 500);
store = gtk_tree_store_new (TOTAL_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING);
tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
gtk_widget_show(scroll_win);
gtk_widget_show(tree);
- nb_trace = lttv_traceset_selector_number(s);
+ nb_trace = lttv_traceset_selector_trace_number(s);
for(i=0;i<nb_trace;i++){
- trace = lttv_traceset_selector_get(s, i);
+ trace = lttv_traceset_selector_trace_get(s, i);
name = lttv_trace_selector_get_name(trace);
gtk_tree_store_append (store, &iter, NULL);
checked = lttv_trace_selector_get_selected(trace);
CHECKBOX_COLUMN,checked,
NAME_COLUMN,name,
-1);
- nb_tracefile = lttv_trace_selector_number(trace);
+
+ gtk_tree_store_append (store, &child_iter, &iter);
+ gtk_tree_store_set (store, &child_iter,
+ CHECKBOX_COLUMN, checked,
+ NAME_COLUMN,"eventtype",
+ -1);
+
+ nb_eventtype = lttv_trace_selector_eventtype_number(trace);
+ for(j=0;j<nb_eventtype;j++){
+ eventtype = lttv_trace_selector_eventtype_get(trace,j);
+ name = lttv_eventtype_selector_get_name(eventtype);
+ checked = lttv_eventtype_selector_get_selected(eventtype);
+ gtk_tree_store_append (store, &child_iter1, &child_iter);
+ gtk_tree_store_set (store, &child_iter1,
+ CHECKBOX_COLUMN, checked,
+ NAME_COLUMN,name,
+ -1);
+ }
+
+ nb_tracefile = lttv_trace_selector_tracefile_number(trace);
for(j=0;j<nb_tracefile;j++){
- tracefile = lttv_trace_selector_get(trace, j);
+ tracefile = lttv_trace_selector_tracefile_get(trace, j);
name = lttv_tracefile_selector_get_name(tracefile);
gtk_tree_store_append (store, &child_iter, &iter);
checked = lttv_tracefile_selector_get_selected(tracefile);
CHECKBOX_COLUMN, checked,
NAME_COLUMN,name,
-1);
+
+ gtk_tree_store_append (store, &child_iter1, &child_iter);
+ gtk_tree_store_set (store, &child_iter1,
+ CHECKBOX_COLUMN, checked,
+ NAME_COLUMN,"eventtype",
+ -1);
+
+ for(k=0;k<nb_eventtype;k++){
+ eventtype = lttv_tracefile_selector_eventtype_get(tracefile,k);
+ name = lttv_eventtype_selector_get_name(eventtype);
+ checked = lttv_eventtype_selector_get_selected(eventtype);
+ gtk_tree_store_append (store, &child_iter2, &child_iter1);
+ gtk_tree_store_set (store, &child_iter2,
+ CHECKBOX_COLUMN, checked,
+ NAME_COLUMN,name,
+ -1);
+ }
}
}
#include <lttv/lttvfilter.h>
#include <stdio.h>
#include <ltt/trace.h>
+#include <ltt/type.h>
struct _LttvTracesetSelector {
char * traceset_name;
- GPtrArray *traces;
+ GPtrArray * traces;
};
struct _LttvTraceSelector {
char * trace_name;
GPtrArray * tracefiles;
+ GPtrArray * eventtypes;
gboolean selected;
};
struct _LttvTracefileSelector {
char * tracefile_name;
+ GPtrArray * eventtypes;
+ gboolean selected;
+};
+
+struct _LttvEventtypeSelector {
+ char * eventtype_name;
gboolean selected;
};
trace = g_new(LttvTraceSelector, 1);
trace->trace_name = g_strdup(ltt_trace_name(t));
trace->tracefiles = g_ptr_array_new();
+ trace->eventtypes = g_ptr_array_new();
trace->selected = TRUE;
return trace;
}
tracefile = g_new(LttvTracefileSelector, 1);
tracefile->tracefile_name = g_strdup(ltt_tracefile_name(t));
+ tracefile->eventtypes = g_ptr_array_new();
tracefile->selected = TRUE;
return tracefile;
}
+LttvEventtypeSelector *lttv_eventtype_selector_new(LttEventType * et)
+{
+ LttvEventtypeSelector * ev;
+ ev = g_new(LttvEventtypeSelector, 1);
+ ev->eventtype_name = g_strdup(ltt_eventtype_name(et));
+ ev->selected = TRUE;
+ return ev;
+}
void lttv_traceset_selector_destroy(LttvTracesetSelector *s)
{
{
int i;
LttvTracefileSelector * t;
+ LttvEventtypeSelector * e;
for(i=0;i<s->tracefiles->len;i++){
t = (LttvTracefileSelector*)s->tracefiles->pdata[i];
lttv_tracefile_selector_destroy(t);
}
+ for(i=0;i<s->eventtypes->len;i++){
+ e = (LttvEventtypeSelector*)s->eventtypes->pdata[i];
+ lttv_eventtype_selector_destroy(e);
+ }
if(s->trace_name) g_free(s->trace_name);
g_free(s);
}
void lttv_tracefile_selector_destroy(LttvTracefileSelector *t)
{
+ int i;
+ LttvEventtypeSelector * e;
+
+ for(i=0;i<t->eventtypes->len;i++){
+ e = (LttvEventtypeSelector*)t->eventtypes->pdata[i];
+ lttv_eventtype_selector_destroy(e);
+ }
+
if(t->tracefile_name) g_free(t->tracefile_name);
g_free(t);
}
-void lttv_traceset_selector_add(LttvTracesetSelector *s, LttvTraceSelector *t)
+void lttv_eventtype_selector_destroy(LttvEventtypeSelector *e)
+{
+ if(e->eventtype_name) g_free(e->eventtype_name);
+ free(e);
+}
+
+void lttv_traceset_selector_trace_add(LttvTracesetSelector *s,
+ LttvTraceSelector *t)
{
g_ptr_array_add(s->traces, t);
}
-void lttv_trace_selector_add(LttvTraceSelector *s, LttvTracefileSelector *t)
+void lttv_trace_selector_tracefile_add(LttvTraceSelector *s,
+ LttvTracefileSelector *t)
{
g_ptr_array_add(s->tracefiles, t);
}
+void lttv_trace_selector_eventtype_add(LttvTraceSelector *s,
+ LttvEventtypeSelector *et)
+{
+ g_ptr_array_add(s->eventtypes, et);
+}
+
+void lttv_tracefile_selector_eventtype_add(LttvTracefileSelector *s,
+ LttvEventtypeSelector *et)
+{
+ g_ptr_array_add(s->eventtypes, et);
+}
-unsigned lttv_traceset_selector_number(LttvTracesetSelector *s)
+unsigned lttv_traceset_selector_trace_number(LttvTracesetSelector *s)
{
return s->traces->len;
}
-unsigned lttv_trace_selector_number(LttvTraceSelector *s)
+unsigned lttv_trace_selector_tracefile_number(LttvTraceSelector *s)
{
return s->tracefiles->len;
}
-LttvTraceSelector *lttv_traceset_selector_get(LttvTracesetSelector *s, unsigned i)
+unsigned lttv_trace_selector_eventtype_number(LttvTraceSelector *s)
+{
+ return s->eventtypes->len;
+}
+
+unsigned lttv_tracefile_selector_eventtype_number(LttvTracefileSelector *s)
+{
+ return s->eventtypes->len;
+}
+
+LttvTraceSelector *lttv_traceset_selector_trace_get(LttvTracesetSelector *s,
+ unsigned i)
{
g_assert(s->traces->len > i);
return ((LttvTraceSelector *)s->traces->pdata[i]);
}
-LttvTracefileSelector *lttv_trace_selector_get(LttvTraceSelector *s, unsigned i)
+LttvTracefileSelector *lttv_trace_selector_tracefile_get(LttvTraceSelector *s,
+ unsigned i)
{
g_assert(s->tracefiles->len > i);
return ((LttvTracefileSelector *)s->tracefiles->pdata[i]);
}
-void lttv_traceset_selector_remove(LttvTracesetSelector *s, unsigned i)
+LttvEventtypeSelector *lttv_trace_selector_eventtype_get(LttvTraceSelector *s,
+ unsigned i)
+{
+ g_assert(s->eventtypes->len > i);
+ return ((LttvEventtypeSelector *)s->eventtypes->pdata[i]);
+}
+
+LttvEventtypeSelector *lttv_tracefile_selector_eventtype_get(LttvTracefileSelector *s,
+ unsigned i)
+{
+ g_assert(s->eventtypes->len > i);
+ return ((LttvEventtypeSelector *)s->eventtypes->pdata[i]);
+}
+
+void lttv_traceset_selector_trace_remove(LttvTracesetSelector *s, unsigned i)
{
g_assert(s->traces->len > i);
g_ptr_array_remove_index(s->traces, i);
}
-void lttv_trace_selector_remove(LttvTraceSelector *s, unsigned i)
+void lttv_trace_selector_tracefile_remove(LttvTraceSelector *s, unsigned i)
{
g_assert(s->tracefiles->len > i);
g_ptr_array_remove_index(s->tracefiles, i);
}
+void lttv_trace_selector_eventtype_remove(LttvTraceSelector *s, unsigned i)
+{
+ g_assert(s->eventtypes->len > i);
+ g_ptr_array_remove_index(s->eventtypes, i);
+}
+
+void lttv_tracefile_selector_eventtype_remove(LttvTracefileSelector *s, unsigned i)
+{
+ g_assert(s->eventtypes->len > i);
+ g_ptr_array_remove_index(s->eventtypes, i);
+}
void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g)
{
s->selected = g;
}
+void lttv_eventtype_selector_set_selected(LttvEventtypeSelector *s, gboolean g)
+{
+ s->selected = g;
+}
+
gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s)
{
return s->selected;
return s->selected;
}
+gboolean lttv_eventtype_selector_get_selected(LttvEventtypeSelector *s)
+{
+ return s->selected;
+}
+
+char * lttv_traceset_selector_get_name(LttvTracesetSelector *s)
+{
+ return s->traceset_name;
+}
+
char * lttv_trace_selector_get_name(LttvTraceSelector *s)
{
return s->trace_name;
{
return s->tracefile_name;
}
+
+char * lttv_eventtype_selector_get_name(LttvEventtypeSelector *s)
+{
+ return s->eventtype_name;
+}
+
+LttvEventtypeSelector * lttv_eventtype_selector_clone(LttvEventtypeSelector * s)
+{
+ LttvEventtypeSelector * ev = g_new(LttvEventtypeSelector, 1);
+ ev->eventtype_name = g_strdup(s->eventtype_name);
+ ev->selected = s->selected;
+ return ev;
+}
+
+void lttv_eventtype_selector_copy(LttvTraceSelector * s, LttvTracefileSelector * d)
+{
+ int i, len;
+ LttvEventtypeSelector * ev, *ev1;
+
+ len = s->eventtypes->len;
+ for(i=0;i<len;i++){
+ ev = lttv_trace_selector_eventtype_get(s,i);
+ ev1 = lttv_eventtype_selector_clone(ev);
+ lttv_tracefile_selector_eventtype_add(d,ev1);
+ }
+}
#include <ltt/event.h>
#include <ltt/type.h>
#include <ltt/trace.h>
+#include <ltt/facility.h>
#include <string.h>
//#include "mw_api.h"
end.tv_sec = G_MAXULONG;
end.tv_nsec = G_MAXULONG;
get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE, &size);
+ if(size == 0){
+ get_events(event_viewer_data, start, end, G_MAXULONG, &size);
+ }
}else size = 1;
if(size > 0) event_number = event_viewer_data->start_event_index + 1;
else event_number = event_viewer_data->start_event_index;
break;
case SCROLL_PAGE_DOWN:
- if(event_viewer_data->end_event_index >= event_viewer_data->number_of_events - 1 - list_height){
+ i = event_viewer_data->number_of_events - 1 - list_height;
+ if((gint)(event_viewer_data->end_event_index) >= i){
event_viewer_data->append = TRUE;
first = event_viewer_data->raw_trace_data_queue->head;
if(!first)break;
end.tv_sec = G_MAXULONG;
end.tv_nsec = G_MAXULONG;
get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE,&size);
+ if(size == 0){
+ get_events(event_viewer_data, start, end, G_MAXULONG,&size);
+ }
}
if(list_height <= event_viewer_data->number_of_events - 1 - event_viewer_data->end_event_index)
event_number = event_viewer_data->start_event_index + list_height - 1;
start = ltt_time_add(event_viewer_data->time_span.startTime, time);
event_viewer_data->previous_value = time_value;
get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE,&size);
- if(size < list_height){
+ if(size < list_height && size > 0){
event_viewer_data->append = FALSE;
first = event_viewer_data->raw_trace_data_queue->head;
if(!first)break;
event_viewer_data->start_event_index = event_viewer_data->current_event_index;
}
event_number = event_viewer_data->raw_trace_data_queue->length - list_height;
+ }else if(size == 0){
+ get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE*RESERVE_SMALL_SIZE,&size);
+ event_number = 0;
}else{
event_number = 0;
}
first = event_viewer_data->raw_trace_data_queue->head;
if(first){
raw_data = (RawTraceData*)g_list_nth_data(first,event_number);
+ if(!raw_data) raw_data = (RawTraceData*)g_list_nth_data(first,0);
time = ltt_time_sub(raw_data->time, event_viewer_data->time_span.startTime);
event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
event_viewer_data->start_event_index = event_number;
event_viewer_data->end_event_index = event_number + list_height - 1;
+ if(event_viewer_data->end_event_index > event_viewer_data->number_of_events - 1){
+ event_viewer_data->end_event_index = event_viewer_data->number_of_events - 1;
+ }
first = event_viewer_data->raw_trace_data_queue->head;
gtk_list_store_clear(event_viewer_data->store_m);
}
-
+/* If every module uses the filter, maybe these two
+ * (add/remove_context_hooks functions) should be put in common place
+ */
void add_context_hooks(EventViewerData * event_viewer_data,
LttvTracesetContext * tsc)
{
- gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+ gint i, j, k, m,n, nbi, id;
+ gint nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
LttTrace *trace;
LttvTraceContext *tc;
LttvTracefileContext *tfc;
LttvTraceSelector * t_s;
LttvTracefileSelector * tf_s;
gboolean selected;
+ LttFacility * fac;
+ LttEventType * et;
+ LttvEventtypeSelector * eventtype;
ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(event_viewer_data->hbox_v),
event_viewer_data->filter_key);
nbi = lttv_traceset_number(tsc->ts);
for(i = 0 ; i < nbi ; i++) {
- t_s = lttv_traceset_selector_get(ts_s,i);
+ t_s = lttv_traceset_selector_trace_get(ts_s,i);
selected = lttv_trace_selector_get_selected(t_s);
if(!selected) continue;
tc = tsc->traces[i];
nb_tracefile = nb_control + nb_per_cpu;
for(j = 0 ; j < nb_tracefile ; j++) {
- tf_s = lttv_trace_selector_get(t_s,j);
+ tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;
tfc = tc->per_cpu_tracefiles[j - nb_control];
//if there are hooks for tracefile, add them here
- lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
- event_viewer_data->before_event_hooks,NULL);
+ // lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
+ // event_viewer_data->before_event_hooks,NULL);
+
+ nb_facility = ltt_trace_facility_number(trace);
+ n = 0;
+ for(k=0;k<nb_facility;k++){
+ fac = ltt_trace_facility_get(trace,k);
+ nb_event = (int) ltt_facility_eventtype_number(fac);
+ for(m=0;m<nb_event;m++){
+ et = ltt_facility_eventtype_get(fac,m);
+ eventtype = lttv_tracefile_selector_eventtype_get(tf_s, n);
+ selected = lttv_eventtype_selector_get_selected(eventtype);
+ if(selected){
+ id = (gint) ltt_eventtype_id(et);
+ lttv_tracefile_context_add_hooks_by_id(tfc,id,
+ event_viewer_data->before_event_hooks,
+ NULL);
+ }
+ n++;
+ }
+ }
+
}
}
void remove_context_hooks(EventViewerData * event_viewer_data,
LttvTracesetContext * tsc)
{
- gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+ gint i, j, k, m, nbi, n, id;
+ gint nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
LttTrace *trace;
LttvTraceContext *tc;
LttvTracefileContext *tfc;
LttvTraceSelector * t_s;
LttvTracefileSelector * tf_s;
gboolean selected;
+ LttFacility * fac;
+ LttEventType * et;
+ LttvEventtypeSelector * eventtype;
ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(event_viewer_data->hbox_v),
event_viewer_data->filter_key);
nbi = lttv_traceset_number(tsc->ts);
for(i = 0 ; i < nbi ; i++) {
- t_s = lttv_traceset_selector_get(ts_s,i);
+ t_s = lttv_traceset_selector_trace_get(ts_s,i);
selected = lttv_trace_selector_get_selected(t_s);
if(!selected) continue;
tc = tsc->traces[i];
nb_tracefile = nb_control + nb_per_cpu;
for(j = 0 ; j < nb_tracefile ; j++) {
- tf_s = lttv_trace_selector_get(t_s,j);
+ tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;
tfc = tc->per_cpu_tracefiles[j - nb_control];
//if there are hooks for tracefile, remove them here
- lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
- event_viewer_data->before_event_hooks,NULL);
+ // lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
+ // event_viewer_data->before_event_hooks,NULL);
+
+ nb_facility = ltt_trace_facility_number(trace);
+ n = 0;
+ for(k=0;k<nb_facility;k++){
+ fac = ltt_trace_facility_get(trace,k);
+ nb_event = (int) ltt_facility_eventtype_number(fac);
+ for(m=0;m<nb_event;m++){
+ et = ltt_facility_eventtype_get(fac,m);
+ eventtype = lttv_tracefile_selector_eventtype_get(tf_s, n);
+ selected = lttv_eventtype_selector_get_selected(eventtype);
+ if(selected){
+ id = (gint) ltt_eventtype_id(et);
+ lttv_tracefile_context_remove_hooks_by_id(tfc,id);
+ }
+ n++;
+ }
+ }
}
}
//remove hooks from context
nbi = lttv_traceset_number(tsc->ts);
for(i = 0 ; i < nbi ; i++) {
- t_s = lttv_traceset_selector_get(ts_s,i);
+ t_s = lttv_traceset_selector_trace_get(ts_s,i);
selected = lttv_trace_selector_get_selected(t_s);
if(!selected) continue;
tc = tsc->traces[i];
nb_tracefile = nb_control + nb_per_cpu;
for(j = 0 ; j < nb_tracefile ; j++) {
- tf_s = lttv_trace_selector_get(t_s,j);
+ tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;
nbi = lttv_traceset_number(tsc->ts);
for(i = 0 ; i < nbi ; i++) {
- t_s = lttv_traceset_selector_get(ts_s,i);
+ t_s = lttv_traceset_selector_trace_get(ts_s,i);
selected = lttv_trace_selector_get_selected(t_s);
if(!selected) continue;
tc = tsc->traces[i];
nb_tracefile = nb_control + nb_per_cpu;
for(j = 0 ; j < nb_tracefile ; j++) {
- tf_s = lttv_trace_selector_get(t_s,j);
+ tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;