X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Ftracecontext.c;h=e4f89a72067e4eb3696df9f85ec39be8bf38373b;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=1123bf7b40710ebeb4c123434ed098c12948dfad;hpb=556b540ae4beba8dd3dd0d628e149c6b93eb4c29;p=lttv.git diff --git a/lttv/lttv/tracecontext.c b/lttv/lttv/tracecontext.c index 1123bf7b..e4f89a72 100644 --- a/lttv/lttv/tracecontext.c +++ b/lttv/lttv/tracecontext.c @@ -12,8 +12,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -22,10 +22,12 @@ #include #include -#include +#include #include #include +#ifdef BABEL_NOFILTER #include +#endif #include #include #include @@ -36,6 +38,8 @@ #include #include + +#ifdef BABEL_CLEANUP gint compare_tracefile(gconstpointer a, gconstpointer b) { gint comparison = 0; @@ -71,7 +75,7 @@ struct _LttvTracesetContextPosition { * set, else, a position is set (may be end * of trace, with ep->len == 0) */ }; - +#endif void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts) { LTTV_TRACESET_CONTEXT_GET_CLASS(self)->init(self, ts); @@ -120,6 +124,8 @@ lttv_context_new_tracefile_context(LttvTracesetContext *self) void lttv_traceset_context_compute_time_span(LttvTracesetContext *self, TimeInterval *time_span) { + //todo mdenis: adapt to babeltrace +#ifdef BABEL_CLEANUP LttvTraceset * traceset = self->ts; int numTraces = lttv_traceset_number(traceset); int i; @@ -134,6 +140,7 @@ void lttv_traceset_context_compute_time_span(LttvTracesetContext *self, for(i=0; itraces[i]; + trace = tc->t; ltt_trace_time_span_get(trace, &s, &e); @@ -154,6 +161,7 @@ void lttv_traceset_context_compute_time_span(LttvTracesetContext *self, time_span->end_time = e; } } +#endif } static void init_tracefile_context(LttTracefile *tracefile, @@ -202,7 +210,8 @@ init(LttvTracesetContext *self, LttvTraceset *ts) &begin_pos, NULL); self->event_hooks = lttv_hooks_new(); -#ifdef BABEL_CLEANUP + self->tmpState = g_new(LttvTraceState *, 1); + for(i = 0 ; i < nb_trace ; i++) { tc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self); self->traces[i] = tc; @@ -210,12 +219,15 @@ init(LttvTracesetContext *self, LttvTraceset *ts) tc->ts_context = self; tc->index = i; tc->vt = lttv_traceset_get(ts, i); +#ifdef BABEL_CLEANUP tc->t = lttv_trace(tc->vt); +#endif tc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); tc->t_a = lttv_trace_attribute(tc->vt); tc->tracefiles = g_array_sized_new(FALSE, TRUE, sizeof(LttvTracefileContext*), 10); +#ifdef BABEL_CLEANUP tracefiles_groups = ltt_trace_get_tracefiles_groups(tc->t); if(tracefiles_groups != NULL) { args.func = (ForEachTraceFileFunc)init_tracefile_context; @@ -225,12 +237,14 @@ init(LttvTracesetContext *self, LttvTraceset *ts) (GDataForeachFunc)compute_tracefile_group, &args); } +#endif } -#endif self->sync_position = lttv_traceset_context_position_new(self); +#ifdef BABEL_CLEANUP self->pqueue = g_tree_new(compare_tracefile); +#endif lttv_process_traceset_seek_time(self, ltt_time_zero); lttv_traceset_context_compute_time_span(self, &self->time_span); @@ -679,15 +693,14 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, unsigned count = 0; + gint last_ret = 0; struct bt_ctf_event *bt_event; LttvEvent event; - /* TODO ybrosseau 2012-03-16: Put in really in the traceset */ - LttvTraceState state; while(TRUE) { - if((count >= nb_events) && (nb_events != G_MAXULONG)) { + if(last_ret == TRUE || ((count >= nb_events) && (nb_events != G_MAXULONG))) { break; } @@ -696,9 +709,11 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, count++; event.bt_event = bt_event; - event.state = &state; - - lttv_hooks_call(self->event_hooks, &event); + /* TODO ybrosseau 2012-04-01: use bt_ctf_get_trace_handle + to retrieve the right state container */ + event.state = self->tmpState; + + last_ret = lttv_hooks_call(self->event_hooks, &event); if(bt_iter_next(bt_ctf_get_iter(self->iter)) < 0) { printf("ERROR NEXT\n"); @@ -878,9 +893,6 @@ void lttv_process_traceset_end(LttvTracesetContext *self, */ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) { - - -#ifdef BABEL_CLEANUP guint i, nb_tracefile; gint ret; @@ -913,7 +925,6 @@ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) g_debug("test tree after seek_time"); g_tree_foreach(pqueue, test_tree, NULL); #endif //DEBUG -#endif } /****************************************************************************