From: Yannick Brosseau Date: Mon, 11 Jun 2012 15:53:37 +0000 (-0400) Subject: Implement LttvTracesetPosition X-Git-Tag: v1.5-beta1~70 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3d1e7ee596d5eef4a50ff7e77d3617643eca133e;p=lttv.git Implement LttvTracesetPosition (Might need more tests) Signed-off-by: Yannick Brosseau --- diff --git a/lttv/lttv/traceset.c b/lttv/lttv/traceset.c index bfab0368..b4a14384 100644 --- a/lttv/lttv/traceset.c +++ b/lttv/lttv/traceset.c @@ -394,19 +394,30 @@ guint lttv_trace_get_num_cpu(LttvTrace *t) LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset) { -#warning "TODO" - return NULL; + LttvTracesetPosition *traceset_pos; + + traceset_pos = g_new(LttvTracesetPosition, 1); + + /* Check in the new passed */ + if(traceset_pos == NULL) { + return NULL; + } + + traceset_pos->iter = traceset->iter; + traceset_pos->bt_pos = bt_iter_get_pos(bt_ctf_get_iter(traceset->iter)); + + return traceset_pos; } void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos) { -#warning "TODO" - return NULL; + bt_iter_free_pos(traceset_pos->bt_pos); + g_free(traceset_pos); } void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos) { -#warning "TODO" + bt_iter_set_pos(traceset_pos->iter, traceset_pos->bt_pos); } guint lttv_traceset_get_cpuid_from_event(LttvEvent *event) diff --git a/lttv/lttv/traceset.h b/lttv/lttv/traceset.h index b58ca27c..65be5efe 100644 --- a/lttv/lttv/traceset.h +++ b/lttv/lttv/traceset.h @@ -56,6 +56,7 @@ struct _LttvTrace { /* In babeltrace, the position concept is an iterator. */ struct _LttvTracesetPosition { struct bt_ctf_iter *iter; + struct bt_iter_pos *bt_pos; }; /* Tracesets may be added to, removed from and their content listed. */