From c95fc0fb80a5e72cf198e77c9bf64fd17286dfde Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 28 Apr 2015 22:25:24 +0200 Subject: Fix counting lost frames --- pcitool/cli.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pcitool/cli.c b/pcitool/cli.c index 60beb3c..79ec9ce 100644 --- a/pcitool/cli.c +++ b/pcitool/cli.c @@ -1285,8 +1285,10 @@ int GrabCallback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *us ctx->event_pending = 0; ctx->event_count++; - - ctx->missing_count += (info->seqnum - ctx->last_num) - 1; + + if (ctx->last_num) + ctx->missing_count += (info->seqnum - ctx->last_num) - 1; + ctx->last_num = info->seqnum; if (info->flags&PCILIB_EVENT_INFO_FLAG_BROKEN) { @@ -1361,7 +1363,8 @@ int raw_data(pcilib_event_id_t event_id, pcilib_event_info_t *info, pcilib_event } ctx->event_count++; - ctx->missing_count += (info->seqnum - ctx->last_num) - 1; + if (ctx->last_num) + ctx->missing_count += (info->seqnum - ctx->last_num) - 1; ctx->last_num = info->seqnum; } -- cgit v1.2.3