Re: Statistics Extraction



doni wrote:

(snipped)

I wanted to extract specific information of MAC and PHY statistics from
the statistics log file.

MAC statistics:
0 frames with invalid header
546 confirmed frames sent succesfully


#!perl

&Query;

sub Query
{
my ($yes_no);
print "Statistics To Search: MAC PHY Network?\n";
$search = <STDIN>;
chomp $search;
print "Search $search correct? Yes No?\n";
$yes_no = <STDIN>;
if (!($yes_no =~ /yes/i))
{ &Query; }
elsif (!($search =~ /mac|phy|network/i))
{ print "Incorrect Statistics To Search\n"; &Query; }
else
{
print "Enter Search Terms: ";
$search_terms = <STDIN>;
if (!($search_terms))
{ &Query; }
else
{ chomp ($search_terms); &Search; }
}
}

sub Search
{
$search_terms =~ tr/A-Z/a-z/;

if ($search =~ /mac/i)
{
print "\n";
while (<DATA>)
{
if (index ($_, "PHY") > -1)
{ print "\nFinished Searching MAC"; last; }
if (index ($_, $search_terms) > -1)
{ print $_; }
}
}
elsif ($search =~ /phy/i)
{
my ($phy);
print "\n";
while (<DATA>)
{
if (index ($_, "Network") > -1)
{ print "\nFinished Searching PHY"; last; }
if (index ($_, "PHY") > -1)
{ $phy = "true"; }
if ($phy eq "true")
{
if (index ($_, $search_terms) > -1)
{ print $_; }
}
}
}
else
{
my ($network);
print "\n";
while (<DATA>)
{
if (index ($_, "Network") > -1)
{ $network = "true"; }
if ($network eq "true")
{
if (index ($_, $search_terms) > -1)
{ print $_; }
}
}
print "\nFinished Searching Network";
}
}

__DATA__
MAC statistics:
0 frames with invalid header
546 confirmed frames sent succesfully
1693 confirmed frames sent unsuccesfully
542 confirmed frames received
4597 total frames received
851 data packets received
549 packets sent successfully
152 packets sent unsuccessfully
763 packets queued by network layer
61 packet transmissions timed out
0 packets with invalid length
0 out of order fragments received
87 duplicate fragments received
0 partial packets received
4 packet reassemblies timed out
0 no buffers
PHY statistics:
3404 frames transmitted
105 transmits aborted due to rx
0 transmit errors
0 late transmits
11 tx buffer loads interrupted
0 tx buffer load failures
4598 receive interrupts
4598 frames received
0 received frames lost
0 zero length frames received
0 receive cmd errors
Network statistics:
851 total packets received
0 bad packet length
0 bad version number
0 outgoing packets with no route
0 input packets with bad destination address
0 input packets from wrong channel
0 packets dropped for exceeding TTL
0 packets dropped due to full socket buffers
0 packets dropped due to no receiver
0 packets dropped due to running out of memory
762 total packets sent
549 packets succesfully transmitted
213 packets sent unsuccessfully

--
Purl Gurl

.



Relevant Pages

  • Re: Statistics Extraction
    ... 546 confirmed frames sent succesfully ... 549 packets sent successfully ... 105 transmits aborted due to rx ... packets dropped due to no receiver ...
    (comp.lang.perl.misc)
  • Re: [Security, resend] Instant crash with rtl8169 and large packets
    ... network switch can handle jumbo frames). ... and apparently NIC happily delivers packets with larger sizes, ... machines too. ... issue with these NICs -- the famous, ...
    (Linux-Kernel)
  • Re: [Security, resend] Instant crash with rtl8169 and large packets
    ... network switch can handle jumbo frames). ... doing the ping test with the above change (no more large packets were ... When this driver queues a skb in rx queue, it tells NIC the max size ... issue with these NICs -- the famous, ...
    (Linux-Kernel)
  • Re: Statistics Extraction
    ... print "MAC stats for 'frames with invalid header': ... 549 packets sent successfully ... 105 transmits aborted due to rx ... packets dropped due to no receiver ...
    (comp.lang.perl.misc)
  • Re: Statistics Extraction
    ... and NETWORK Stats in here but in the file there will be atleast 10 ... 546 confirmed frames sent succesfully ... 549 packets sent successfully ... packets dropped due to no receiver ...
    (comp.lang.perl.misc)