blob: 98174b8d35fd148c145a060f440707d2072595f1 [file] [log] [blame]
#!/usr/bin/perl
$stats_header_file = 'qtn_muc_stats_print.h';
$dbg_header_file = "muc_txrx_stats.h.raw";
$in_tx_struct=0;
$tx_stats_content = "";
$in_rx_struct=0;
$rx_stats_content = "";
$rxq_num = 0;
foreach my $line (`cat muc_share_def.h`) {
if ($line =~ /^\#define\s+QTN_FW_WMAC_RX_QNUM\s+(\d+).*$/) {
$rxq_num = $1;
}
}
if ($rxq_num == 0) {
die("muc_dbg_parse: fail to find macro QTN_FW_WMAC_RX_QNUM\n");
}
open(HDRFILE,"$dbg_header_file");
while (<HDRFILE>) {
if (/\}/) {
if ($in_tx_struct == 1) {
$tx_stats_content .= "}";
$in_tx_struct=0;
}
if ($in_rx_struct == 1) {
$rx_stats_content .= "}";
$in_rx_struct=0;
}
}
if ($in_tx_struct) {
if(/(\w+)\;/){
$strtmp = $1;
$tx_stats_content .= " \"$strtmp\", \\\n";
} else {
die("muc_dbg_parse: fail to process tx stats item \"$_\"");
}
}
if ($in_rx_struct) {
if (/(\w+)\;/) {
$strtmp = $1;
$rx_stats_content .= " \"$strtmp\", \\\n";
} elsif (/(rxq_\w+)\[\w+\]\;/) {
$strtmp = $1;
for (my $i = 0; $i < $rxq_num; $i++) {
$rx_stats_content .= " \"$strtmp"."[$i]\", \\\n";
}
} else {
die("muc_dbg_parse: fail to process rx stats item \"$_\"");
}
}
if (/^\s*struct\s+muc_tx_stats\s*\{/) {
$in_tx_struct=1;
$tx_stats_content .= "#define MUC_TX_STATS_NAMES_TABLE { \\\n";
}
if (/^\s*struct\s+muc_rx_stats\s*\{/) {
$in_rx_struct=1;
$rx_stats_content .= "#define MUC_RX_STATS_NAMES_TABLE { \\\n";
}
}
close(HDRFILE);
unlink($stats_header_file);
open(headfile,">>$stats_header_file");
print headfile "/* autogenerated */\n\n";
print headfile $tx_stats_content;
print headfile "\n\n";
print headfile $rx_stats_content;
print headfile "\n";
close(headfile);