ProgressBar::writeStatus

@param     $done
@param     $total
@param int $size
@param int $lineWidth
185390
protected function writeStatus($done, $total, $size = 30, $lineWidth = -1)
    {
        if ($lineWidth <= 0) {
            $lineWidth = input()->env('COLUMNS');
        }

        static $start_time;

        // to take account for [ and ]
        $size -= 3;
        // if we go over our bound, just ignore it
        if ($done > $total) {
            return;
        }

        if (empty($start_time)) {
            $start_time = time();
        }
        $now = time();

        $percent = (double)($done / $total);

        $bar = floor($percent * $size);

        // jump to the begining
        output()->write("\r");

        // jump a line up
        output()->write("\x1b[A");

        $statusBar = "[";
        $statusBar .= str_repeat("=", $bar);
        if ($bar < $size) {
            $statusBar .= ">";
            $statusBar .= str_repeat(" ", $size - $bar);
        } else {
            $statusBar .= "=";
        }

        $percentOutput = number_format($percent * 100, 0);

        $statusBar .= "]";
        $details = "$percentOutput%  $done/$total";

        $rate = ($now - $start_time) / $done;
        $left = $total - $done;
        $eta = round($rate * $left, 2);

        $elapsed = $now - $start_time;


        $details .= ' ' . language()->getLine('CLI_PROGRESS_BAR_ESTIMATION') . ': ' . $this->formatTime($eta) . ' ' . language()->getLine('CLI_PROGRESS_BAR_ELAPSED') . ': ' . $this->formatTime($elapsed) . ' ';

        $lineWidth--;
        if (strlen($details) >= $lineWidth) {
            $details = substr($details, 0, $lineWidth - 1);
        }

        output()->write(implode(PHP_EOL, [
            $details,
            $statusBar,
        ]));

        //echo "$details\n$status_bar";

        flush();

        // when done, send a newline
        if ($done == $total) {
            //echo "\n";
            output()->write(PHP_EOL);
        }

    }
193653
protected void writeLine(final String line) {
		getContainer().getShell().getDisplay().syncExec(
			new Runnable() {
				public void run() {
					if (statusTextArea != null) {
						statusTextArea.setText(line + '\n' + statusTextArea.getText()); 
					}
				}
			}
		);
	}
1339711
public void write(DataOutput out) throws IOException {
    Text.writeString(out, trackerName);
    Text.writeString(out, host);
    out.writeInt(httpPort);
    out.writeInt(failures);
    out.writeInt(maxMapTasks);
    out.writeInt(maxReduceTasks);
    resStatus.write(out);
    out.writeInt(taskReports.size());

    for (TaskStatus taskStatus : taskReports) {
      TaskStatus.writeTaskStatus(out, taskStatus);
    }
    getHealthStatus().write(out);
  }
323227
@Override
    public void indicateProgress(int number, int total) {
        progressIndicatorActive = true;
        String currMsg = lastMessage;
        try {
            updateStatus(currMsg + ' ' + number + " of " + total);
        } finally {
            lastMessage = currMsg;
        }
    }
799722
function(id, name, loaded, total) {
            this._parent.prototype._onProgress.apply(this, arguments);

            this._templating.updateProgress(id, loaded, total);

            if (total === 0 || Math.round(loaded / total * 100) === 100) {
                this._templating.hideCancel(id);
                this._templating.hidePause(id);
                this._templating.hideProgress(id);
                this._templating.setStatusText(id, this._options.text.waitingForResponse);

                // If ~last byte was sent, display total file size
                this._displayFileSize(id);
            }
            else {
                // If still uploading, display percentage - total size is actually the total request(s) size
                this._displayFileSize(id, loaded, total);
            }
        }
414122
protected function emitProgress($progress, $step=0, $totalSteps=1, $stepName='')
    {

        if (!$progress instanceof Progress) {
            $progress =  new Progress($progress, $step, $totalSteps, $stepName);
        }

        foreach ($this->progressListeners as $listener) {
            call_user_func($listener, $progress);
        }
    }
854051
private function getProgressBar(OutputInterface $output, int $total): ProgressBar
    {
        return $this->getProgressBarFactory()->getProgressBar($output, $total);
    }
838278
public function postRun(): void {
    if ($this->progress) {
      $this->progress->finish();
      // Progress bar does not print a new-line at the end.
      $this->getOutput()->writeln('');
    }
  }
185206
public void write(DataOutput out) throws IOException {
    taskid.write(out);
    out.writeFloat(progress);
    out.writeInt(numSlots);
    WritableUtils.writeEnum(out, runState);
    Text.writeString(out, diagnosticInfo);
    Text.writeString(out, stateString);
    WritableUtils.writeEnum(out, phase);
    out.writeLong(startTime);
    out.writeLong(finishTime);
    out.writeBoolean(includeCounters);
    out.writeLong(outputSize);
    if (includeCounters) {
      counters.write(out);
    }
    nextRecordRange.write(out);
  }
1316157
public function set_count($try, $count) {
        $this->totalcount = $this->totalcount + $count;
        $this->trycount[$try] = $count;
    }
591955
public void notifyUpdate( URL resource, int expected, int count )
    {
        if( m_first )
        {
            m_expected = expected;
            m_start = System.currentTimeMillis();
            m_first = false;
        }
        int completed = ( count * 100 ) / expected;
        m_out.print( resource.toExternalForm() + " : " + completed + "%    \r" );
    }
1185647
public void write(DataOutput out) throws IOException {
    taskid.write(out);
    out.writeFloat(progress);
    Text.writeString(out, state);
    out.writeLong(startTime);
    out.writeLong(finishTime);
    WritableUtils.writeStringArray(out, diagnostics);
    counters.write(out);
    WritableUtils.writeEnum(out, currentStatus);
    if (currentStatus == TIPStatus.RUNNING) {
      WritableUtils.writeVInt(out, runningAttempts.size());
      TaskAttemptID t[] = new TaskAttemptID[0];
      t = runningAttempts.toArray(t);
      for (int i = 0; i < t.length; i++) {
        t[i].write(out);
      }
    } else if (currentStatus == TIPStatus.COMPLETE) {
      successfulAttempt.write(out);
    }
  }
862244
@Override
	public void writeFixed(byte[] bytes, int start, int len) throws IOException {
		out.write(bytes, start, len);
	}
971248
function(total, timeout) {
  events.EventEmitter.call(this);

  if (! isPositiveInteger(total)) {
    throw new Error('`total` must be a positive integer');
  }

  if (timeout && ! isPositiveInteger(timeout)) {
    throw new Error('`timeout` must be a positive integer');
  }

  this.destroyed = false;
  this.total = total;
	this.fired = 0;
  if (timeout) {
    this.timer = setTimeout(function() {
      this.onTimeout();
    }.bind(this), timeout);
  }
}
159409
public function onCollectionAfter()
    {
        if ($this->progress) {
            $this->progress->finish();
            $this->output->writeln(''); // new line after progress bar
        }
        $this->output->writeln('<info>[END]</info>');
    }
42935
def write(self, *args, **kwargs):
        """"""

        self.progress_status()

        # Check abortes state and raise StopIteration if aborted
        if self.aborted:
            statustext = _("File saving aborted.")
            post_command_event(self.main_window, self.main_window.StatusBarMsg,
                               text=statustext)
            return False

        return self.parent_cls.write(self, *args, **kwargs)
434308
public function total($count)
    {
        if ($this->get) {
            $this->total = ($count > $this->limit) ? ceil($count / $this->limit) : 1;
        }
    }