Resque\Commands\SpeedTest::setProgress PHP Method

setProgress() public method

http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
public setProgress ( Symfony\Component\Console\Output\OutputInterface $output, $stats, $testTime, $start )
$output Symfony\Component\Console\Output\OutputInterface
    public function setProgress(OutputInterface $output, $stats, $testTime, $start)
    {
        static $reset = false;
        $exec_time = round(microtime(true) - $start);
        $rate = @$stats['processed'] / max($exec_time, 1);
        $progress_length = 35;
        $progress_percent = (microtime(true) - $start) / $testTime;
        $progress_bar = str_repeat('<comment>=</comment>', $progress_complete_length = round($progress_percent * $progress_length));
        $progress_bar .= $progress_complete_length == $progress_length ? '' : '<pop>></pop>';
        $progress_bar .= str_repeat('-', max($progress_length - $progress_complete_length - 1, 0));
        $progress_bar .= $progress_complete_length == $progress_length ? '' : ' ' . round($progress_percent * 100) . '%';
        $display = <<<STATS
<comment>%title% php-resque speed test</comment>%clr%
%progress%%clr%
Time:         <pop>%in%</pop>%clr%
Processed:    <pop>%jobs%</pop>%clr%
Speed:        <pop>%speed%</pop>%clr%
Avg job time: <pop>%time%</pop>%clr%
STATS;
        $replace = array('%title%' => $exec_time == $testTime ? 'Finished' : 'Running', '%progress%' => $progress_bar, '%jobs%' => @$stats['processed'] . ' job' . (@$stats['processed'] == 1 ? '' : 's'), '%in%' => $exec_time . 's' . ($progress_complete_length == $progress_length ? '' : ' (' . $testTime . 's test)'), '%speed%' => round($rate, 1) . ' jobs/s', '%time%' => $rate > 0 ? round(1 / $rate * 1000, 1) . ' ms' : '-', '%clr%' => "");
        $output->writeln(($reset ? "" : '') . strtr($display, $replace));
        !$reset and $reset = true;
    }