Earindil has asked for the wisdom of the Perl Monks concerning the following question:
foreach $server (@servers) { chomp $server; open TMP, ">/tmp/$server.tmp"; $ENV{"FILENAME"} = "/tmp/$server\.tmp"; # SUPER INEFFIECIENT, looping through all of the data for each s +erver. Need to rethink this foreach (@DATA) { ($hostid, $time, $get, $post, $currconn) = split(/\t/); next if ($hostid ne $SERVER{$server}); $time = ((int($time/300))*300)+10800; # Add 3 hours for EST + time ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = loca +ltime($time); $year+=1900; $year = substr($year,2); $mon++; $mon = "0".$mon if ($month < 10); $mday = "0".$mday if ($mday < 10); $hour = "0".$hour if ($hour < 10); $min = "0".$min if ($min < 10); $time = "$mon/$mday/$year\.$hour:$min"; $total = $get+$post; print TMP "$time\t$server\t$get\t$post\t$total\t$currconn\n" +; $total_get{"$time"} += $get; $total_post{"$time"} += $post; $total_conn{"$time"} += $currconn; } close TMP; if (!$ARGV[3]) { `$dir/plbin210/bin/pl $dir/WebHits.pol -o $output_dir/graphs/$server\_ +webhits.gif -gif title="$server Gets, Posts and Opens"`; `$dir/plbin210/bin/pl $dir/WebHits.pol -o $output_dir/graphs/$server\_ +Twebhits.gif -gif -scale 0.50 title="$server $hour:$min"`; }
update (broquaint): changed <pre> to <code> tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Super Duper Inefficient
by particle (Vicar) on Jun 20, 2003 at 13:13 UTC | |
by Earindil (Beadle) on Jun 20, 2003 at 13:19 UTC | |
by particle (Vicar) on Jun 20, 2003 at 13:26 UTC | |
Re: Super Duper Inefficient
by EvdB (Deacon) on Jun 20, 2003 at 13:10 UTC | |
by Anonymous Monk on Jun 20, 2003 at 13:35 UTC | |
Re: Super Duper Inefficient
by nite_man (Deacon) on Jun 20, 2003 at 13:42 UTC | |
by Earindil (Beadle) on Jun 20, 2003 at 14:02 UTC | |
Re: Super Duper Inefficient
by benn (Vicar) on Jun 20, 2003 at 13:18 UTC | |
Re: Super Duper Inefficient
by hmerrill (Friar) on Jun 20, 2003 at 13:23 UTC |