Returns processing rate in bytes/ms
348880
@Override
  public double getMapByteProcessingRate(long currentTime) {
    @SuppressWarnings("deprecation")
    long bytesProcessed = super.getCounters().findCounter
        (Task.Counter.MAP_INPUT_BYTES).getCounter();
    return calculateRate(bytesProcessed, currentTime);
  }
298522
def bytes(self):
        """"""
        flagByte = 0x00
        messageType = 0
        if self._messageType is not None:
            messageType = self._messageType << 5
        extendedBit = 0 if self._extended is None else self._extended << 4
        hopsMax = 0 if self._hopsMax is None else self._hopsMax
        hopsLeft = 0 if self._hopsLeft is None else (self._hopsLeft << 2)
        flagByte = flagByte | messageType | extendedBit | hopsLeft | hopsMax
        return bytes([flagByte])
1011279
void returnProcessedBytes(Http2Stream http2Stream, int bytes) {
    try {
      decoder().flowController().consumeBytes(http2Stream, bytes);
    } catch (Http2Exception e) {
      throw new RuntimeException(e);
    }
  }
421568
public double getProcessingRate(TaskStatus.Phase phase) {
    // we don't have processing rate information for the starting and cleaning
    // up phase
    if (phase != TaskStatus.Phase.MAP && 
        phase != TaskStatus.Phase.SHUFFLE &&
        phase != TaskStatus.Phase.SORT &&
        phase != TaskStatus.Phase.REDUCE) {
      return 0;
    }
    return processingRates.getRate(getProcessingPhase());
  }
1063902
def convert_bytes(bytes_, K=1 << 10, M=1 << 20, G=1 << 30, T=1 << 40):
    """"""
    fn = float(bytes_)
    if bytes_ >= T:
        return '%.1fT' % (fn / T)
    elif bytes_ >= G:
        return '%.1fG' % (fn / G)
    elif bytes_ >= M:
        return '%.1fM' % (fn / M)
    elif bytes_ >= K:
        return '%.1fK' % (fn / K)
    else:
        return '%d' % bytes_
269559
function calcFsSpeed(rx, wx) {
  let result = {
    rx: 0,
    wx: 0,
    tx: 0,
    rx_sec: -1,
    wx_sec: -1,
    tx_sec: -1,
    ms: 0
  };

  if (_fs_speed && _fs_speed.ms) {
    result.rx = rx;
    result.wx = wx;
    result.tx = result.rx + result.wx;
    result.ms = Date.now() - _fs_speed.ms;
    result.rx_sec = (result.rx - _fs_speed.bytes_read) / (result.ms / 1000);
    result.wx_sec = (result.wx - _fs_speed.bytes_write) / (result.ms / 1000);
    result.tx_sec = result.rx_sec + result.wx_sec;
    _fs_speed.rx_sec = result.rx_sec;
    _fs_speed.wx_sec = result.wx_sec;
    _fs_speed.tx_sec = result.tx_sec;
    _fs_speed.bytes_read = result.rx;
    _fs_speed.bytes_write = result.wx;
    _fs_speed.bytes_overall = result.rx + result.wx;
    _fs_speed.ms = Date.now();
    _fs_speed.last_ms = result.ms;
  } else {
    result.rx = rx;
    result.wx = wx;
    result.tx = result.rx + result.wx;
    _fs_speed.rx_sec = -1;
    _fs_speed.wx_sec = -1;
    _fs_speed.tx_sec = -1;
    _fs_speed.bytes_read = result.rx;
    _fs_speed.bytes_write = result.wx;
    _fs_speed.bytes_overall = result.rx + result.wx;
    _fs_speed.ms = Date.now();
    _fs_speed.last_ms = 0;
  }
  return result;
}
1051926
def benchmark_process_and_backend(exe, backend):
    """"""
    env = dict(os.environ)
    env['GOLESS_BACKEND'] = backend
    args = [exe, '-m', 'benchmark']
    return get_benchproc_results(args, env=env)
908872
def read_bytes(fo, writer_schema=None, reader_schema=None):
    """"""
    size = read_long(fo)
    return fo.read(size)
854863
def get_process_output(process, encoding=None):
    """"""

    output = process.communicate()
    returncode = process.returncode

    if not encoding:
        try:
            encoding = sys.stdout.encoding
        except Exception:
            encoding = locale.getpreferredencoding()

    if returncode != 0:
        raise RuntimeError("Runtime Error: %s" % (output[0].rstrip().decode(encoding, errors='replace')))

    return output[0].decode(encoding, errors='replace')
38914
def _print_speed(self):
        ''''''
        if self._bandwidth_meter.num_samples:
            speed = self._bandwidth_meter.speed()

            if self._human_format:
                file_size_str = wpull.string.format_size(speed)
            else:
                file_size_str = '{:.1f} b'.format(speed * 8)

            speed_str = _('{preformatted_file_size}/s').format(
                preformatted_file_size=file_size_str
            )
        else:
            speed_str = _('-- B/s')

        self._print(speed_str)
219960
def rate(self):
        """"""
        return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate)
1266974
def bitrate(self):
        
        b=0
        if self.__dict__['bit_rate']:
            try:
                b=int(self.__dict__['bit_rate'])
            except Exception as e:
                print "None integer bitrate"
        return b
1188098
def _orted_process():
    """"""
    for i in range(5 * 60):
        procs = [p for p in psutil.process_iter(attrs=['name']) if p.info['name'] == 'orted']

        if procs:
            return procs
        time.sleep(1)
128169
def rate(self):
        
        if (
            (self.fragment_type != self.REGULAR) or
            (self.has_zero_length)
        ):
            return None
        return Decimal(self.chars / self.length)
375079
def parse_output(self, s):
        '''
        
        '''

        for x in s.splitlines():
            if '%' in x:
                name = x.split(':')[0].strip().lower()
                nbytes = x.split(':')[1].split('b')[0].strip()
                nbytes = int(nbytes)
                perc = x.split('(')[1].split('%')[0].strip()
                perc = float(perc)
                if name == 'program':
                    self.program_bytes = nbytes
                    self.program_percentage = perc
                else:
                    self.data_bytes = nbytes
                    self.data_percentage = perc
627855
def timing(self, stat, delta, rate=1):
        """"""
        return self.send(stat, "%d|ms" % delta, rate)
1131924
def rate():
    """"""
    auth = request.authorization

    if not auth or not check_auth(auth.username, auth.password):
        return "60/minute"
    else:
        return "600/minute"