|
From: Barry G. <mai...@pe...> - 2005-11-04 02:08:47
|
At 03:11 PM 11/3/2005, West, Jonathan (NIH/NIMH) wrote: >I'm guessing that the site ><http://www.auralizer.com/>www.auralizer.com has been down for quite >a while. I was wondering if anyone has produced a network load >client that maybe does something like monitor TCP-dump and cause >more sound when the network load is higher. You could do that (on linux at least) by checking the numbers in /proc/net/dev every few seconds. Perl code below (not integrated with peep though.) Barry #!/usr/bin/perl -w #prints time and bandwidth statistics (in kilobits) $interval = 10; #seconds #open (LOGFILE, ">net-bandwidth.log") || die "Can't open log: $!.\n"; sub getpkt { open DEV,"/proc/net/dev"; while(<DEV>) { if(/eth0/) { @line=split(/:|\s+/); close DEV; return $line[2] ."\t". $line[10]; } } close DEV; } ($inpkts,$outpkts) = split("\t", getpkt()); while(1){ sleep $interval; ($inpkts2,$outpkts2) = split("\t", getpkt()); #in $inbw = 8*(($inpkts2-$inpkts)/$interval)/1024; #out $outbw= 8*(($outpkts2-$outpkts)/$interval)/1024; #max $max = ($inbw > $outbw) ? $inbw : $outbw; #printf LOGFILE "%d\t%d\t%d\t%d\n", time(), $inbw, $outbw, $max; printf "%d\t%d\t%d\t%d\n", time(), $inbw, $outbw, $max; $inpkts = $inpkts2; $outpkts = $outpkts2; } |