summaryrefslogtreecommitdiffstats
path: root/pcitool/cli.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-28 22:25:24 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-28 22:25:24 +0200
commitc95fc0fb80a5e72cf198e77c9bf64fd17286dfde (patch)
treed0240c34a2066d7152482e6550f833e522b8444f /pcitool/cli.c
parent7ddaa80e4308b34253f30ed25b9e775810cdf115 (diff)
downloadpcitool-c95fc0fb80a5e72cf198e77c9bf64fd17286dfde.tar.gz
pcitool-c95fc0fb80a5e72cf198e77c9bf64fd17286dfde.tar.bz2
pcitool-c95fc0fb80a5e72cf198e77c9bf64fd17286dfde.tar.xz
pcitool-c95fc0fb80a5e72cf198e77c9bf64fd17286dfde.zip
Fix counting lost frames
Diffstat (limited to 'pcitool/cli.c')
-rw-r--r--pcitool/cli.c9
1 files 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;
}