Fix end of the trace handling and end position
authorYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Mar 2013 21:42:42 +0000 (17:42 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Mar 2013 21:42:42 +0000 (17:42 -0400)
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
lttv/lttv/traceset-process.c

index dc45b17d3a88c043f23f5bdfed06ceae150b7f4f..8d0f696840d0051da1bd5fdee941447612c4fa2e 100644 (file)
@@ -65,7 +65,11 @@ guint lttv_process_traceset_middle(LttvTraceset *traceset,
        struct bt_ctf_event *bt_event;
        
        LttvEvent event;
-  
+       LttTime endPositionTime;
+
+       if(end_position) {
+               endPositionTime = lttv_traceset_position_get_time(end_position);
+       }
        while(TRUE) {
 
                if(last_ret == TRUE || ((count >= nb_events) && (nb_events != G_MAXULONG))) {
@@ -78,13 +82,17 @@ guint lttv_process_traceset_middle(LttvTraceset *traceset,
                        if(ltt_time_compare(end, time) <= 0) {
                                break;
                        }
-                       
+                       /*
                        currentPos = lttv_traceset_create_current_position(traceset);
                        if(lttv_traceset_position_compare(currentPos,end_position ) == 0){
                                lttv_traceset_destroy_position(currentPos);
                                break;
                        }
                        lttv_traceset_destroy_position(currentPos);
+                       */
+                       if(end_position && (ltt_time_compare(endPositionTime, time) <= 0)) {
+                               break;
+                       }
                        count++;
 
                        event.bt_event = bt_event;
@@ -277,10 +285,10 @@ guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts,
                 do {
                         if((ret = lttv_traceset_position_compare(currentPos,initialPos)) == 1){       
                                if(bt_iter_next(bt_ctf_get_iter(ts->iter)) == 0) {
-                                       if(bt_ctf_iter_read_event(ts->iter) != NULL) {
-                                       lttv_traceset_destroy_position(currentPos);
-                                       currentPos = lttv_traceset_create_current_position(ts);
-                                       count++;
+                                       if(bt_ctf_iter_read_event(ts->iter) > 0) {
+                                               lttv_traceset_destroy_position(currentPos);
+                                               currentPos = lttv_traceset_create_current_position(ts);
+                                               count++;
                                        } else  {
                                                break;
                                        }
This page took 0.024602 seconds and 4 git commands to generate.