Updates css; improves html and table alignment; fixes pathing;

This commit is contained in:
Jed Reynolds
2018-10-10 15:30:37 -07:00
parent 4f807e4d29
commit 496d38933e

View File

@@ -66,7 +66,7 @@ my $ampdu_pkt_count_total_rx = 0;
my $wmm_info = ""; my $wmm_info = "";
my $dut = ""; my $dut = "";
my $report_prefix = "wifi-diag-"; our $report_prefix = "wifi-diag-";
my $non_dut_frames = 0; my $non_dut_frames = 0;
my $show_help = 0; my $show_help = 0;
my $gen_report = 0; my $gen_report = 0;
@@ -91,7 +91,7 @@ GetOptions
( (
'help|h' => \$show_help, 'help|h' => \$show_help,
'dut=s' => \$dut, 'dut=s' => \$dut,
'report_prefix=s' => \$report_prefix, 'report_prefix=s' => \$::report_prefix,
'gen_report' => \$gen_report, 'gen_report' => \$gen_report,
) || (print STDERR $usage && exit(1)); ) || (print STDERR $usage && exit(1));
@@ -100,14 +100,15 @@ if ($show_help) {
print $usage; print $usage;
exit 0 exit 0
} }
$::report_prefix .= "/"
my $glb_ba_tx_fname = $report_prefix . "glb-ba-tx-rpt.txt"; if ($report_prefix !~ m{/$});
my $glb_ba_rx_fname = $report_prefix . "glb-ba-rx-rpt.txt"; my $glb_ba_tx_fname = $::report_prefix . "glb-ba-tx-rpt.txt";
my $glb_mcs_ps_fname = $report_prefix . "glb-mcs-ps-rpt.txt"; my $glb_ba_rx_fname = $::report_prefix . "glb-ba-rx-rpt.txt";
my $glb_mcs_tx_fname = $report_prefix . "glb-mcs-tx-rpt.txt"; my $glb_mcs_ps_fname = $::report_prefix . "glb-mcs-ps-rpt.txt";
my $glb_mcs_rx_fname = $report_prefix . "glb-mcs-rx-rpt.txt"; my $glb_mcs_tx_fname = $::report_prefix . "glb-mcs-tx-rpt.txt";
my $glb_rtx_tx_fname = $report_prefix . "glb-rtx-tx-rpt.txt"; my $glb_mcs_rx_fname = $::report_prefix . "glb-mcs-rx-rpt.txt";
my $glb_rtx_rx_fname = $report_prefix . "glb-rtx-rx-rpt.txt"; my $glb_rtx_tx_fname = $::report_prefix . "glb-rtx-tx-rpt.txt";
my $glb_rtx_rx_fname = $::report_prefix . "glb-rtx-rx-rpt.txt";
if ($gen_report) { if ($gen_report) {
$report_html .= genGlobalReports(); $report_html .= genGlobalReports();
@@ -218,55 +219,35 @@ sub saveHtmlReport {
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>WiFi Diag Report</title> <title>WiFi Diag Report</title>
<style> <style>
body { body {
font-family: Arial, Helvetica,sans-serif; font-family: Arial, Helvetica,sans-serif;
color: rgb(42,91,41); font-size: 14px;
} color: #204020;
#main { }
border: 0; table {
padding: 0; border-collapse: collapse;
margin: 0; background: #e0e0e0;
width: 100%; }
text-align: left; table, td, th {
vertical-align: top; border: 1px solid gray;
display: block; padding: 4px;
/*white-space: nowrap;*/ }
td {
background: white;
}
td.ar {
text-align: right;
} }
ul#swlinks, #swlinks * { h1, h2, th {
background: #e0e0e0; color: rgb(42,91,41);
font-size: small;
color: #404040;
}
ul#swlinks {
border: 4px solid #e0e0e0;
}
ul#swlinks, #swlinks ul {
padding-left: 1.3em;
margin-left: 0em;
}
#swlinks dt, #swlinks a {
font-size: 11pt;
font-weight: bold;
margin-left: 0;
padding-left: 0;
}
#swlinks dd, #swlinks li {
padding-left: 0em;
margin-left: 0em;
}
#swlinks a #swlinks li ul li, #swlinks li ul li a {
font-size: 10pt;
}
h1, h2 {
text-align: center; text-align: center;
} }
</style> </style>
</head> </head>
<body > <body >
<h1>WiFi Diag Report.</h1> <h1>WiFi Diag Report</h1>
<P> <P>
); );
@@ -275,7 +256,8 @@ h1, h2 {
$html .= "</body> $html .= "</body>
</html>\n"; </html>\n";
my $tmp = "$report_prefix/index.html"; my $tmp = "$::report_prefix/index.html";
$tmp =~ s{//}{/}g;
open(my $IDX, ">", $tmp) or die("Can't open $tmp for writing: $!\n"); open(my $IDX, ">", $tmp) or die("Can't open $tmp for writing: $!\n");
print $IDX $html; print $IDX $html;
close $IDX; close $IDX;
@@ -289,22 +271,23 @@ sub genTimeGnuplot {
my $cols = shift; my $cols = shift;
my $graph_data = shift; my $graph_data = shift;
my $text ="# auto-generated gnuplot script my $text =qq(#!/usr/bin/gnuplot
#!/usr/bin/gnuplot # auto-generated gnuplot script
reset reset
set terminal png set terminal png
set xdata time set xdata time
set timefmt \"\%s\" set timefmt '\%s'
set format x \"\%M:\%S\" set format x '\%M:\%S'
set xlabel \"Date\" set xlabel "Date"
set ylabel \"$ylabel\" set ylabel '$ylabel'
set title \"$title\" set title '$title'
set key below set key below
set grid set grid
plot \"$graph_data\" using $cols title \"$title\"\n"; plot '$graph_data' using $cols title '$title'
);
return $text; return $text;
} }
@@ -318,8 +301,10 @@ sub doTimeGraph {
my $html = ""; my $html = "";
my $text = genTimeGnuplot($ylabel, $title, $cols, $data_file); my $text = genTimeGnuplot($ylabel, $title, $cols, $data_file);
my $png_fname = "$report_prefix$out_file"; my $png_fname = "$::report_prefix/$out_file";
$png_fname =~ s{//}{/}g;
my $tmp = $report_prefix . "_gnuplot_tmp_script.txt"; my $tmp = $report_prefix . "_gnuplot_tmp_script.txt";
$tmp =~ s{//}{/}g;
open(my $GP, ">", $tmp) or die("Can't open $tmp for writing: $!\n"); open(my $GP, ">", $tmp) or die("Can't open $tmp for writing: $!\n");
print $GP $text; print $GP $text;
close $GP; close $GP;
@@ -327,7 +312,7 @@ sub doTimeGraph {
print "cmd: $cmd\n"; print "cmd: $cmd\n";
system($cmd); system($cmd);
$html .= "<img src=\"$out_file\" alt=\"$title\"><br>\n"; $html .= qq(<img src="$out_file" alt="$title"><br>\n);
return $html; return $html;
} }
@@ -374,50 +359,50 @@ sub htmlMcsHistogram {
$html .= "WMM Info from DUT Beacon<br><pre>\n$wmm_info</pre>"; $html .= "WMM Info from DUT Beacon<br><pre>\n$wmm_info</pre>";
} }
$html .= "TX Encoding rate histogram.\n $html .= "<h4>TX Encoding rate histogram.</h4>\n
<table $html_table_border><tr><th>Rate Mbps</th><th>Packets</th><th>Percentage</th></tr>"; <table $html_table_border><tr><th>Rate Mbps</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort {$a <=> $b} keys %glb_mcs_tx_hash) { foreach my $name (sort {$a <=> $b} keys %glb_mcs_tx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%f</td></tr>\n", $name, $glb_mcs_tx_hash{$name}, ($glb_mcs_tx_hash{$name} * 100.0) / $tx_pkts); $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_mcs_tx_hash{$name}, ($glb_mcs_tx_hash{$name} * 100.0) / $tx_pkts);
} }
$html .= "</table><P>\n"; $html .= "</table><P>\n";
$html .= "RX Encoding rate histogram.\n $html .= "<h4>RX Encoding rate histogram</h4>\n
<table $html_table_border><tr><th>Rate Mbps</th><th>Packets</th><th>Percentage</th></tr>"; <table $html_table_border><tr><th>Rate Mbps</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort {$a <=> $b} keys %glb_mcs_rx_hash) { foreach my $name (sort {$a <=> $b} keys %glb_mcs_rx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%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 .= "</table>\n";
$html .= "TX Packet Type histogram.\n $html .= "<h4>TX Packet Type histogram</h4>\n
<table $html_table_border><tr><th>Type</th><th>Packets</th><th>Percentage</th></tr>"; <table $html_table_border><tr><th>Type</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort keys %glb_pkt_type_tx_hash) { foreach my $name (sort keys %glb_pkt_type_tx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%f</td></tr>\n", $name, $glb_pkt_type_tx_hash{$name}, ($glb_pkt_type_tx_hash{$name} * 100.0) / $tx_pkts); $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_pkt_type_tx_hash{$name}, ($glb_pkt_type_tx_hash{$name} * 100.0) / $tx_pkts);
} }
$html .= "</table><P>\n"; $html .= "</table>\n";
$html .= "RX Packet Type histogram.\n $html .= "<h4>RX Packet Type histogram</h4>\n
<table $html_table_border><tr><th>Type</th><th>Packets</th><th>Percentage</th></tr>"; <table $html_table_border><tr><th>Type</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort keys %glb_pkt_type_rx_hash) { foreach my $name (sort keys %glb_pkt_type_rx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%f</td></tr>\n", $name, $glb_pkt_type_rx_hash{$name}, ($glb_pkt_type_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_pkt_type_rx_hash{$name}, ($glb_pkt_type_rx_hash{$name} * 100.0) / $rx_pkts);
} }
$html .= "</table><P>\n"; $html .= "</table><P>\n";
if ($ampdu_chain_tx_count) { if ($ampdu_chain_tx_count) {
$html .= "TX AMPDU chain count histogram, average: " . $ampdu_pkt_count_total_tx / $ampdu_chain_tx_count . "\n"; $html .= "<h4>TX AMPDU chain count histogram<h4>Average: " . $ampdu_pkt_count_total_tx / $ampdu_chain_tx_count . "\n";
$html .= "<table $html_table_border><tr><th>Chain Count</th><th>Packets</th><th>Percentage</th></tr>"; $html .= "<table $html_table_border><tr><th>Chain Count</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort {$a <=> $b} keys %glb_ampdu_pkt_count_tx_hash) { foreach my $name (sort {$a <=> $b} keys %glb_ampdu_pkt_count_tx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%f</td></tr>\n", $name, $glb_ampdu_pkt_count_tx_hash{$name}, ($glb_ampdu_pkt_count_tx_hash{$name} * 100.0) / $ampdu_chain_tx_count); $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_ampdu_pkt_count_tx_hash{$name}, ($glb_ampdu_pkt_count_tx_hash{$name} * 100.0) / $ampdu_chain_tx_count);
} }
$html .= "</table><P>\n"; $html .= "</table>\n";
} }
if ($ampdu_chain_rx_count) { if ($ampdu_chain_rx_count) {
$html .= "RX AMPDU chain count histogram, average: " . $ampdu_pkt_count_total_rx / $ampdu_chain_rx_count . "\n"; $html .= "<h4>RX AMPDU chain count histogram</h4> Average: " . $ampdu_pkt_count_total_rx / $ampdu_chain_rx_count . "\n";
$html .= "<table $html_table_border><tr><th>Chain Count</th><th>Packets</th><th>Percentage</th></tr>"; $html .= "<table $html_table_border><tr><th>Chain Count</th><th>Packets</th><th>Percentage</th></tr>";
foreach my $name (sort {$a <=> $b} keys %glb_ampdu_pkt_count_rx_hash) { foreach my $name (sort {$a <=> $b} keys %glb_ampdu_pkt_count_rx_hash) {
$html .= sprintf("<tr><td>%s</td><td>%s</td><td>%f</td></tr>\n", $name, $glb_ampdu_pkt_count_rx_hash{$name}, ($glb_ampdu_pkt_count_rx_hash{$name} * 100.0) / $ampdu_chain_rx_count); $html .= sprintf(qq(<tr><td>%s</td><td class="ar">%s</td><td class="ar">%f</td></tr>\n), $name, $glb_ampdu_pkt_count_rx_hash{$name}, ($glb_ampdu_pkt_count_rx_hash{$name} * 100.0) / $ampdu_chain_rx_count);
} }
$html .= "</table><P>\n"; $html .= "</table>\n";
} }
return $html; return $html;