Use the in development bt_iter_equals_pos
authorYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Mar 2013 22:20:04 +0000 (18:20 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Mar 2013 22:20:04 +0000 (18:20 -0400)
Added configure check and fallback in case you do not have
the prototype version of babeltrace

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

index 1dc396c10cafa6f23135e75a5254fed1d32c43bb..ccd2f4e6b647025fdc6644a226a1fc9dd9f3e832 100644 (file)
@@ -114,6 +114,11 @@ PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
 
 PKG_CHECK_MODULES(BABELTRACE, [babeltrace >= 1.0.0])
 
+AC_CHECK_LIB([babeltrace], [bt_iter_equals_pos], 
+                          [AC_DEFINE([HAVE_BT_ITER_EQUALS_POS],[],[Have equal function])], [])
+
+
+
 LIBS="$LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS $BABELTRACE_LIBS"
 PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -Wall -Wformat-security"
 
index 8743d70825d54a51549a2f783373f78fca33ff68..765e3cf5552243e90e6e0bec608d0c6f9c196ba2 100644 (file)
@@ -486,7 +486,7 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event)
        if (timestamp == -1ULL) {
                return 0;
        }
-       const struct definition *scope = bt_ctf_get_top_level_scope(ctf_event, BT_STREAM_PACKET_CONTEXT);
+       const struct bt_definition *scope = bt_ctf_get_top_level_scope(ctf_event, BT_STREAM_PACKET_CONTEXT);
        if (bt_ctf_field_get_error()) {
                return 0;
        }
@@ -698,8 +698,12 @@ int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvT
                 return -1;
        }
 
-       int res = bt_iter_equals_pos(pos1->bt_pos, pos2->bt_pos);
-       
+       int res = -1;
+#ifdef HAVE_BT_ITER_EQUALS_POS
+       if(pos1->timestamp == G_MAXUINT64 || pos2->timestamp == G_MAXUINT64) {
+               res = bt_iter_equals_pos(pos1->bt_pos, pos2->bt_pos);
+       }
+#endif
        if (res < 0) {
        
                guint64 timeStampPos1,timeStampPos2;
@@ -708,16 +712,16 @@ int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvT
                timeStampPos1 = lttv_traceset_position_get_timestamp(pos1);
                timeStampPos2 = lttv_traceset_position_get_timestamp(pos2);
                
+               if (timeStampPos1 == timeStampPos2) {
+
+                       cpuId1 = lttv_traceset_position_get_cpuid(pos1);
+                       cpuId2 = lttv_traceset_position_get_cpuid(pos2);
                
-               cpuId1 = lttv_traceset_position_get_cpuid(pos1);
-               cpuId2 = lttv_traceset_position_get_cpuid(pos2);
-               
-               if(timeStampPos1 == timeStampPos2 && cpuId1 == cpuId2){
-                       return 0;
-               }
-               else{
-                       return 1;
+                       if(cpuId1 == cpuId2){
+                               return 0;
+                       }
                }
+               return 1;
        } else {
                
                return !res;
This page took 0.026715 seconds and 4 git commands to generate.