0

ダウンロード速度を返す関数( eth0 など)を持つモジュールを知っている人はいますか?

4

2 に答える 2

2

監視プログラムを採用する:top、iftop、ntop、dstat、icinga、munin、knemo、ksysguardd

于 2012-04-11T09:33:49.507 に答える
0
#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes;
use LWP::Simple;

my $url = 'http://www.cnn.com/';
my $file = 'cnn.html';
my $start = [Time::HiRes::gettimeofday()];
getstore($url, $file);
my $time = Time::HiRes::tv_interval($start);
my $size = -s $file;

printf "Speed: %d kbps\n", $size/$time/1000;
于 2012-04-11T16:39:00.363 に答える