Implement LttvTracesetPosition
authorYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Jun 2012 15:53:37 +0000 (11:53 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Jun 2012 21:34:34 +0000 (17:34 -0400)
(Might need more tests)

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
lttv/lttv/traceset.c
lttv/lttv/traceset.h

index bfab0368db84547e0a01718165d56926cb20bae3..b4a14384ef80ec42024ef89ee8a6dabf9a64c92a 100644 (file)
@@ -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)
index b58ca27cc317f010f681ad34d8e42249c3ff10ef..65be5efe3507e92179949af504ead3ec0b46aa9f 100644 (file)
@@ -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. */
This page took 0.024565 seconds and 4 git commands to generate.