diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2018-10-10 18:46:48 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2018-10-10 18:46:48 +0200 |
commit | 9d7d01f24b5e8ac73fbed783cffd5c0f5f6e8a87 (patch) | |
tree | d90f1bb331911cd74aba84bd61b1d0039c475414 /utils/cec-compliance | |
parent | 461c5cb0613d2ed06127f113370931275d4aacc0 (diff) |
cec-compliance: further improvements to CEC_EVENT_LOST_MSGS fail info
Show the number of messages that can be immediately dequeued from
the receive queue, and how many messages trickle in afterwards and
over how many seconds.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r-- | utils/cec-compliance/cec-test-adapter.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp index 6a8ce909..2cf0447c 100644 --- a/utils/cec-compliance/cec-test-adapter.cpp +++ b/utils/cec-compliance/cec-test-adapter.cpp @@ -1026,6 +1026,7 @@ int testLostMsgs(struct node *node) fail_on_test(tx_queue_depth == 0 || tx_queue_depth > 19); unsigned pending_msgs = 0; + unsigned pending_quick_msgs = 0; unsigned pending_tx_ok_msgs = 0; unsigned pending_tx_timed_out_msgs = 0; unsigned pending_tx_arb_lost_msgs = 0; @@ -1033,26 +1034,31 @@ int testLostMsgs(struct node *node) unsigned pending_tx_low_drive_msgs = 0; unsigned pending_tx_error_msgs = 0; unsigned pending_rx_msgs = 0; - - fcntl(node->fd, F_SETFL, fcntl(node->fd, F_GETFL) & ~O_NONBLOCK); - msg.timeout = 3000; - - while (!doioctl(node, CEC_RECEIVE, &msg)) { - pending_msgs++; - if (!msg.sequence) - pending_rx_msgs++; - else if (msg.tx_status & CEC_TX_STATUS_TIMEOUT) - pending_tx_timed_out_msgs++; - else if (msg.tx_status & CEC_TX_STATUS_OK) - pending_tx_ok_msgs++; - else if (msg.tx_status & CEC_TX_STATUS_NACK) - pending_tx_nack_msgs++; - else if (msg.tx_status & CEC_TX_STATUS_ARB_LOST) - pending_tx_arb_lost_msgs++; - else if (msg.tx_status & CEC_TX_STATUS_LOW_DRIVE) - pending_tx_low_drive_msgs++; - else - pending_tx_error_msgs++; + time_t start = time(NULL); + + for (unsigned i = 0; i < 2; i++) { + msg.timeout = 3000; + + while (!doioctl(node, CEC_RECEIVE, &msg)) { + pending_msgs++; + if (i == 0) + pending_quick_msgs++; + if (!msg.sequence) + pending_rx_msgs++; + else if (msg.tx_status & CEC_TX_STATUS_TIMEOUT) + pending_tx_timed_out_msgs++; + else if (msg.tx_status & CEC_TX_STATUS_OK) + pending_tx_ok_msgs++; + else if (msg.tx_status & CEC_TX_STATUS_NACK) + pending_tx_nack_msgs++; + else if (msg.tx_status & CEC_TX_STATUS_ARB_LOST) + pending_tx_arb_lost_msgs++; + else if (msg.tx_status & CEC_TX_STATUS_LOW_DRIVE) + pending_tx_low_drive_msgs++; + else + pending_tx_error_msgs++; + } + fcntl(node->fd, F_SETFL, fcntl(node->fd, F_GETFL) & ~O_NONBLOCK); } /* @@ -1076,6 +1082,10 @@ int testLostMsgs(struct node *node) printf("\t\tError transmits: %d\n", pending_tx_error_msgs); if (pending_rx_msgs) printf("\t\tReceived messages: %d\n", pending_rx_msgs); + if (pending_quick_msgs < pending_msgs) + printf("\t\tReceived %d messages immediately, and %d over %ld seconds\n", + pending_quick_msgs, pending_msgs - pending_quick_msgs, + time(NULL) - start); return fail("There were %d messages in the receive queue for %d transmits\n", pending_msgs, xfer_cnt); } |