From 443db1d0c51a3dffeb53447e2b9cc038b729d7ff Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sun, 5 May 2013 09:38:02 +0000 Subject: [PATCH] This is a simple script to output the delta between each TX and TXSTATUS. Useful for debugging TDMA. --- tools/tools/ath/athalq/txdiff.pl | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tools/tools/ath/athalq/txdiff.pl diff --git a/tools/tools/ath/athalq/txdiff.pl b/tools/tools/ath/athalq/txdiff.pl new file mode 100755 index 000000000000..dff940503a31 --- /dev/null +++ b/tools/tools/ath/athalq/txdiff.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + +use strict; + +# $FreeBSD$ + +# [1360537229.753890] [100494] TXD +# [1360537229.754292] [100494] TXSTATUS: TxDone=1, TS=0x5ccfa5c7 + +my ($tv_sec) = 0; +my ($tv_usec) = 0; + +sub tvdiff($$$$) { + my ($tv1_sec, $tv1_usec, $tv2_sec, $tv2_usec) = @_; + + if ($tv2_usec < $tv1_usec) { + $tv2_usec += 1000000; + $tv1_sec = $tv1_sec + 1; + } + + return ($tv2_sec - $tv1_sec) * 1000000 + ($tv2_usec - $tv1_usec); +} + +while (<>) { + chomp; + m/^\[(.*?)\.(.*?)\]/ || next; + printf "%d\t| %s\n", tvdiff($tv_sec, $tv_usec, $1, $2), $_; +# if (tvdiff($tv_sec, $tv_usec, $1, $2) > 500) { +# printf "%d\t| %s\n", tvdiff($tv_sec, $tv_usec, $1, $2), $_; +# } + $tv_sec = $1; + $tv_usec = $2; +} +