in reply to Live operations-per-second counter
Not so elegant or fast, but works. Thanks everyone!my $stop; my $speed = 0; my $start = time; while (<CONNS>) { $counter++; if ($counter =~ /00$/) { $stop = time; my $diff = $stop - $start; my $tdiff = ($diff == 0) ? 1 : $diff; $speed = sprintf("%.f", ($counter/$tdiff)); } ... line processing ... print "Processed: $counter (at $speed lines/s) \r"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Live operations-per-second counter
by ikegami (Patriarch) on Mar 20, 2005 at 22:46 UTC | |
by blazar (Canon) on Mar 21, 2005 at 07:16 UTC |