]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/ath/athalq/txdiff.pl
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / ath / athalq / txdiff.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 # $FreeBSD$
6
7 # [1360537229.753890] [100494] TXD
8 # [1360537229.754292] [100494] TXSTATUS: TxDone=1, TS=0x5ccfa5c7
9
10 my ($tv_sec) = 0;
11 my ($tv_usec) = 0;
12
13 sub tvdiff($$$$) {
14         my ($tv1_sec, $tv1_usec, $tv2_sec, $tv2_usec) = @_;
15
16         if ($tv2_usec < $tv1_usec) {
17                 $tv2_usec += 1000000;
18                 $tv1_sec = $tv1_sec + 1;
19         }
20
21         return ($tv2_sec - $tv1_sec) * 1000000 + ($tv2_usec - $tv1_usec);
22 }
23
24 while (<>) {
25         chomp;
26         m/^\[(.*?)\.(.*?)\]/ || next;
27         printf "%d\t| %s\n", tvdiff($tv_sec, $tv_usec, $1, $2), $_;
28 #       if (tvdiff($tv_sec, $tv_usec, $1, $2) > 500) {
29 #               printf "%d\t| %s\n", tvdiff($tv_sec, $tv_usec, $1, $2), $_;
30 #       }
31         $tv_sec = $1;
32         $tv_usec = $2;
33 }
34