Horje
tcp traffic analysis linux command line mb per second Code Example
tcp traffic analysis linux command line mb per second
#!/usr/bin/perl
# traffic analysis script using tcpdump
use strict;
use warnings;
use Time::HiRes;

my $reporting_interval = 10.0; # seconds
my $bytes_this_interval = 0;
my $start_time = [Time::HiRes::gettimeofday()];

STDOUT->autoflush(1);

while (<>) {
  if (/ length (\d+):/) {
    $bytes_this_interval += $1;
    my $elapsed_seconds = Time::HiRes::tv_interval($start_time);
    if ($elapsed_seconds > $reporting_interval) {
       my $bps = $bytes_this_interval / $elapsed_seconds;
       printf "%02d:%02d:%02d %10.2f Bps\n", (localtime())[2,1,0],$bps;
       $start_time = [Time::HiRes::gettimeofday()];
       $bytes_this_interval = 0;
    }
  }
}




Shell

Related
attching to milticontainer pod Code Example attching to milticontainer pod Code Example
install onnxmltools Code Example install onnxmltools Code Example
how to look the usb free space in linux command line Code Example how to look the usb free space in linux command line Code Example
diff files in different repositories Code Example diff files in different repositories Code Example
how to create a new instance from cli in cf Code Example how to create a new instance from cli in cf Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
14