summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pcilib/debug.h8
-rw-r--r--pcitool/cli.c22
2 files changed, 26 insertions, 4 deletions
diff --git a/pcilib/debug.h b/pcilib/debug.h
index f9134be..b7c547f 100644
--- a/pcilib/debug.h
+++ b/pcilib/debug.h
@@ -5,6 +5,7 @@
#ifdef PCILIB_DEBUG
# define PCILIB_DEBUG_DMA
+# define PCILIB_DEBUG_MISSING_EVENTS
#endif /* PCILIB_DEBUG */
@@ -14,6 +15,13 @@
# define PCILIB_DEBUG_DMA_CALL(function, ...)
#endif /* PCILIB_DEBUG_DMA */
+#ifdef PCILIB_DEBUG_MISSING_EVENTS
+# define PCILIB_DEBUG_MISSING_EVENTS_CALL(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__)
+#else /* PCILIB_DEBUG_MISSING_EVENTS */
+# define PCILIB_DEBUG_MISSING_EVENTS_CALL(function, ...)
+#endif /* PCILIB_DEBUG_MISSING_EVENTS */
+
+
#define pcilib_debug(function, ...) \
PCILIB_DEBUG_##function##_CALL(PCILIB_DEBUG_##function, __VA_ARGS__)
diff --git a/pcitool/cli.c b/pcitool/cli.c
index b04107b..a8f1e35 100644
--- a/pcitool/cli.c
+++ b/pcitool/cli.c
@@ -35,6 +35,7 @@
#include "tools.h"
#include "kmem.h"
#include "error.h"
+#include "debug.h"
#include "model.h"
/* defines */
@@ -1294,8 +1295,14 @@ int GrabCallback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *us
ctx->event_pending = 0;
ctx->event_count++;
- if (ctx->last_num)
- ctx->missing_count += (info->seqnum - ctx->last_num) - 1;
+ if (ctx->last_num) {
+ size_t missing_count = (info->seqnum - ctx->last_num) - 1;
+ ctx->missing_count += missing_count;
+#ifdef PCILIB_DEBUG_MISSING_EVENTS
+ if (missing_count)
+ pcilib_debug(MISSING_EVENTS, "%zu missing events between %zu and %zu", missing_count, ctx->last_num, info->seqnum);
+#endif /* PCILIB_DEBUG_MISSING_EVENTS */
+ }
ctx->last_num = info->seqnum;
@@ -1371,8 +1378,15 @@ int raw_data(pcilib_event_id_t event_id, pcilib_event_info_t *info, pcilib_event
}
ctx->event_count++;
- if (ctx->last_num)
- ctx->missing_count += (info->seqnum - ctx->last_num) - 1;
+ if (ctx->last_num) {
+ size_t missing_count = (info->seqnum - ctx->last_num) - 1;
+ ctx->missing_count += missing_count;
+#ifdef PCILIB_DEBUG_MISSING_EVENTS
+ if (missing_count)
+ pcilib_debug(MISSING_EVENTS, "%zu missing events between %zu and %zu", missing_count, ctx->last_num, info->seqnum);
+#endif /* PCILIB_DEBUG_MISSING_EVENTS */
+
+ }
ctx->last_num = info->seqnum;
}