X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2FprocessTrace.c;h=122ce5109b14c5f3c0f5bba9886bcb46115b7c03;hb=f1d416441c33c1eb429ddbb8f8a3401c3932fa7c;hp=8723204c70bc58d1b7afa0f9b6da33acf7558205;hpb=cbe7c836abf115b6eb90499429b91180bb5dcfbb;p=lttv.git diff --git a/ltt/branches/poly/lttv/processTrace.c b/ltt/branches/poly/lttv/processTrace.c index 8723204c..122ce510 100644 --- a/ltt/branches/poly/lttv/processTrace.c +++ b/ltt/branches/poly/lttv/processTrace.c @@ -33,7 +33,7 @@ lttv_context_new_trace_context(LttvTracesetContext *self) LttvTracefileContext * lttv_context_new_tracefile_context(LttvTracesetContext *self) { - LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); + return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); } @@ -182,7 +182,7 @@ void lttv_traceset_context_add_hooks(LttvTracesetContext *self, lttv_hooks_add_list(tc->before, before_trace); lttv_hooks_add_list(tc->after, after_trace); nb_control = ltt_trace_control_tracefile_number(tc->t); - nb_per_cpu = ltt_trace_control_tracefile_number(tc->t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(tc->t); nb_tracefile = nb_control + nb_per_cpu; for(j = 0 ; j < nb_tracefile ; j++) { @@ -190,7 +190,7 @@ void lttv_traceset_context_add_hooks(LttvTracesetContext *self, tfc = tc->control_tracefiles[j]; } else { - tfc = tc->per_cpu_tracefiles[j]; + tfc = tc->per_cpu_tracefiles[j-nb_control]; } lttv_hooks_add_list(tfc->check, check_tracefile); lttv_hooks_add_list(tfc->before, before_tracefile); @@ -236,7 +236,7 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self, lttv_hooks_remove_list(tc->before, before_trace); lttv_hooks_remove_list(tc->after, after_trace); nb_control = ltt_trace_control_tracefile_number(tc->t); - nb_per_cpu = ltt_trace_control_tracefile_number(tc->t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(tc->t); nb_tracefile = nb_control + nb_per_cpu; for(j = 0 ; j < nb_tracefile ; j++) { @@ -244,7 +244,7 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self, tfc = tc->control_tracefiles[j]; } else { - tfc = tc->per_cpu_tracefiles[j]; + tfc = tc->per_cpu_tracefiles[j-nb_control]; } lttv_hooks_remove_list(tfc->check, check_tracefile); lttv_hooks_remove_list(tfc->before, before_tracefile); @@ -365,7 +365,7 @@ lttv_trace_context_get_type(void) (GClassInitFunc) trace_context_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (LttvTracesetContext), + sizeof (LttvTraceContext), 0, /* n_preallocs */ (GInstanceInitFunc) trace_context_instance_init /* instance_init */ }; @@ -441,7 +441,7 @@ gboolean get_first(gpointer key, gpointer value, gpointer user_data) { void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset, - LttvTracesetContext *context) + LttvTracesetContext *context, unsigned maxNumEvents) { GPtrArray *traces = g_ptr_array_new(); @@ -460,6 +460,8 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset, LttvTracefileContext *tfc; LttEvent *event; + unsigned count = 0; + LttTime preTimestamp; /* Call all before_traceset, before_trace, and before_tracefile hooks. For all qualifying tracefiles, seek to the start time, create a context, @@ -521,6 +523,23 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset, or more tracefiles have events for the same time, hope that lookup and remove are consistent. */ + count++; + if(count > maxNumEvents){ + if(tfc->timestamp.tv_sec == preTimestamp.tv_sec && + tfc->timestamp.tv_nsec == preTimestamp.tv_nsec) { + count--; + }else{ + while(TRUE){ + tfc = NULL; + g_tree_foreach(pqueue, get_first, &tfc); + if(tfc == NULL) break; + g_tree_remove(pqueue, &(tfc->timestamp)); + } + break; + } + } + preTimestamp = tfc->timestamp; + tfc = g_tree_lookup(pqueue, &(tfc->timestamp)); g_tree_remove(pqueue, &(tfc->timestamp)); @@ -536,7 +555,9 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset, if(event != NULL) { tfc->e = event; tfc->timestamp = ltt_event_time(event); - g_tree_insert(pqueue, &(tfc->timestamp), tfc); + if(tfc->timestamp.tv_sec < end.tv_sec || + (tfc->timestamp.tv_sec == end.tv_sec && tfc->timestamp.tv_nsec <= end.tv_nsec)) + g_tree_insert(pqueue, &(tfc->timestamp), tfc); } }