mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	wifi-diag: Add histogram for encoding types.
HE_SU, OFDMA, VHT, etc. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
		@@ -5,7 +5,6 @@ use strict;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use bignum;
 | 
					use bignum;
 | 
				
			||||||
use bigint;
 | 
					use bigint;
 | 
				
			||||||
 | 
					 | 
				
			||||||
our $d_counter = 0;
 | 
					our $d_counter = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub new {
 | 
					sub new {
 | 
				
			||||||
@@ -26,6 +25,7 @@ sub new {
 | 
				
			|||||||
	      seen_ip => 0,
 | 
						      seen_ip => 0,
 | 
				
			||||||
	      timestamp => 0,
 | 
						      timestamp => 0,
 | 
				
			||||||
	      datarate => 0,
 | 
						      datarate => 0,
 | 
				
			||||||
 | 
					              ppdu_format => "UNKNOWN",
 | 
				
			||||||
	      dummy_tx_pkts => 0,
 | 
						      dummy_tx_pkts => 0,
 | 
				
			||||||
	      dummy_rx_pkts => 0,
 | 
						      dummy_rx_pkts => 0,
 | 
				
			||||||
	      is_last_ampdu => 0,
 | 
						      is_last_ampdu => 0,
 | 
				
			||||||
@@ -126,6 +126,15 @@ sub append {
 | 
				
			|||||||
  elsif ($ln =~ /^.* = Payload Type: MSDU/) {
 | 
					  elsif ($ln =~ /^.* = Payload Type: MSDU/) {
 | 
				
			||||||
    $self->{is_msdu} = 1;
 | 
					    $self->{is_msdu} = 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  elsif ($ln =~ /^.* = PPDU Format: (.*)/) {
 | 
				
			||||||
 | 
					    $self->{ppdu_format} = $1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  elsif ($ln =~ /^\s+PHY type: \S+\s+\((\S+)\)/) {
 | 
				
			||||||
 | 
					     # The PPDU Format matches first, so don't over-ride that if we found something already.
 | 
				
			||||||
 | 
					     if ($self->{ppdu_format} eq "UNKNOWN") {
 | 
				
			||||||
 | 
					        $self->{ppdu_format} = $1; # OFDM etc
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  elsif ($ln =~ /^\s*\[Time delta from previous captured frame:\s+(\S+)/) {
 | 
					  elsif ($ln =~ /^\s*\[Time delta from previous captured frame:\s+(\S+)/) {
 | 
				
			||||||
    $self->{timedelta} = $1;
 | 
					    $self->{timedelta} = $1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,6 +65,8 @@ my %glb_pkt_type_tx_hash = ();
 | 
				
			|||||||
my %glb_pkt_type_rx_hash = ();
 | 
					my %glb_pkt_type_rx_hash = ();
 | 
				
			||||||
my %glb_ampdu_pkt_count_rx_hash = ();
 | 
					my %glb_ampdu_pkt_count_rx_hash = ();
 | 
				
			||||||
my %glb_ampdu_pkt_count_tx_hash = ();
 | 
					my %glb_ampdu_pkt_count_tx_hash = ();
 | 
				
			||||||
 | 
					my %glb_encoding_type_tx_hash = ();
 | 
				
			||||||
 | 
					my %glb_encoding_type_rx_hash = ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $ampdu_pkt_count_total_tx = 0;
 | 
					my $ampdu_pkt_count_total_tx = 0;
 | 
				
			||||||
my $ampdu_pkt_count_total_rx = 0;
 | 
					my $ampdu_pkt_count_total_rx = 0;
 | 
				
			||||||
@@ -454,6 +456,24 @@ sub htmlMcsHistogram {
 | 
				
			|||||||
  foreach my $name (sort {$a <=> $b} keys %glb_mcs_rx_hash) {
 | 
					  foreach my $name (sort {$a <=> $b} keys %glb_mcs_rx_hash) {
 | 
				
			||||||
    $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_mcs_rx_hash{$name}, ($glb_mcs_rx_hash{$name} * 100.0) / $rx_pkts);
 | 
					    $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_mcs_rx_hash{$name}, ($glb_mcs_rx_hash{$name} * 100.0) / $rx_pkts);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  $html .= "</table><P>\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  $html .= "<h4>TX PPDU Format histogram.</h4>\n
 | 
				
			||||||
 | 
					<table $html_table_border><tr><th>PPDU Format</th><th>Packets</th><th>Percentage</th></tr>";
 | 
				
			||||||
 | 
					  foreach my $name (sort keys %glb_encoding_type_tx_hash) {
 | 
				
			||||||
 | 
					    $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n),
 | 
				
			||||||
 | 
					                     $name, $glb_encoding_type_tx_hash{$name}, ($glb_encoding_type_tx_hash{$name} * 100.0) / $tx_pkts);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  $html .= "</table><P>\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  $html .= "<h4>RX PPDU Format histogram.</h4>\n
 | 
				
			||||||
 | 
					<table $html_table_border><tr><th>PPDU Format</th><th>Packets</th><th>Percentage</th></tr>";
 | 
				
			||||||
 | 
					  foreach my $name (sort keys %glb_encoding_type_rx_hash) {
 | 
				
			||||||
 | 
					    $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n),
 | 
				
			||||||
 | 
					                     $name, $glb_encoding_type_rx_hash{$name}, ($glb_encoding_type_rx_hash{$name} * 100.0) / $rx_pkts);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  $html .= "</table><P>\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  $html .= "</table>\n";
 | 
					  $html .= "</table>\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  $html .= "<h4>TX Packet Type histogram</h4>\n
 | 
					  $html .= "<h4>TX Packet Type histogram</h4>\n
 | 
				
			||||||
@@ -781,6 +801,14 @@ sub processPkt {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      $glb_mcs_rx_hash{$dr} = 1;
 | 
					      $glb_mcs_rx_hash{$dr} = 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $dr = $pkt->{ppdu_format};
 | 
				
			||||||
 | 
					    if (exists $glb_encoding_type_rx_hash{$dr}) {
 | 
				
			||||||
 | 
					      $glb_encoding_type_rx_hash{$dr}++;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      $glb_encoding_type_rx_hash{$dr} = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $dr = $pkt->type_subtype() . $pkt->{priority};
 | 
					    $dr = $pkt->type_subtype() . $pkt->{priority};
 | 
				
			||||||
    if (exists $glb_pkt_type_rx_hash{$dr}) {
 | 
					    if (exists $glb_pkt_type_rx_hash{$dr}) {
 | 
				
			||||||
      $glb_pkt_type_rx_hash{$dr}++;
 | 
					      $glb_pkt_type_rx_hash{$dr}++;
 | 
				
			||||||
@@ -852,6 +880,14 @@ sub processPkt {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      $glb_mcs_tx_hash{$dr} = 1;
 | 
					      $glb_mcs_tx_hash{$dr} = 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $dr = $pkt->{ppdu_format};
 | 
				
			||||||
 | 
					    if (exists $glb_encoding_type_tx_hash{$dr}) {
 | 
				
			||||||
 | 
					      $glb_encoding_type_tx_hash{$dr}++;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      $glb_encoding_type_tx_hash{$dr} = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $dr = $pkt->type_subtype() . $pkt->{priority};
 | 
					    $dr = $pkt->type_subtype() . $pkt->{priority};
 | 
				
			||||||
    if (exists $glb_pkt_type_tx_hash{$dr}) {
 | 
					    if (exists $glb_pkt_type_tx_hash{$dr}) {
 | 
				
			||||||
      $glb_pkt_type_tx_hash{$dr}++;
 | 
					      $glb_pkt_type_tx_hash{$dr}++;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user