Assert work is performed within expected iterations per second

 @param [Integer] iterations

 @return [Boolean]

 @api public
439369
def assert_perform_ips(iterations, options = {}, &work)
      mean, stddev, _ = Iteration.run(options, &work)
      iterations <= (mean + 3 * stddev)
    end
811783
boolean invoke() {
        if (complete) {
            return complete;
        }

        if (iterations >= results.length) {
            int newlen = expandTo(results.length);
            if (newlen < 0) {
                complete = true;
                return complete;
            }
            results = Arrays.copyOf(results, newlen);
        }

        long res = Math.max(task.time(), 1);
        results[iterations] = res;
        if (stable.length > 0) {
            stable[iterations % stable.length] = res;
            if (iterations > stable.length && inBounds(stable, stableLimit)) {
                complete = true;
            }
        }

        remainingTime -= res;
        iterations++;

        if (iterations >= limit || remainingTime < 0) {
            complete = true;
        }
        return complete;
    }
1348484
def run
      @patterns.each_index do |i|
        retval = @exp.expect(@patterns[i].pattern, &@patterns[i].block)
        return nil if (retval.nil?)
      end
      return nil
    end
183689
def check(action, recalculate: false)
      return false if adapter.rate_limited?(action.scope, action.identifier) && !recalculate
      timestamp = period_marker(Pause.config.resolution, Time.now.to_i)
      set       = adapter.key_history(action.scope, action.identifier)
      action.checks.each do |period_check|
        start_time = timestamp - period_check.period_seconds
        set.reverse.inject(0) do |sum, element|
          break if element.ts < start_time
          sum += element.count
          if sum >= period_check.max_allowed
            adapter.rate_limit!(action.scope, action.identifier, period_check.block_ttl)
            # Note that Time.now is different from period_marker(resolution, Time.now), which
            # rounds down to the nearest (resolution) seconds
            return Pause::RateLimitedEvent.new(action, period_check, sum, Time.now.to_i)
          end
          sum
        end
      end
      nil
    end
262473
def run_until(target_time)
      return if target_time < now
      
      loop do
        shred, relative_time = next_shred
        break unless shred
        break unless now + relative_time <= target_time
        run_one
      end
      
      # I hope rounding errors are okay
      fast_forward(target_time - now)
    end
910624
def measure
      before = take_time
      yield
      after = take_time
      @repeat += 1
      @times[:repeat] << @repeat
      @times[:scatter] << @scatter
      bs = self.case.batch_size.abs
      if bs and bs > 1
        TIMES.each_with_index { |t, i| @times[t] << (after[i] - before[i]) / bs }
      else
        TIMES.each_with_index { |t, i| @times[t] << after[i] - before[i] }
      end
      @analysis = nil
    end
256254
def pefficiency(self):
        
        timers = self.timers()

        # Number of CPUs employed in each calculation.
        ncpus = [timer.ncpus for timer in timers]

        # Find the minimum number of cpus used and its index in timers.
        min_idx = minloc(ncpus)
        min_ncpus = ncpus[min_idx]

        # Reference timer
        ref_t = timers[min_idx]

        # Compute the parallel efficiency (total and section efficiency)
        peff = {}
        ctime_peff = [(min_ncpus * ref_t.wall_time) / (t.wall_time * ncp) for (t, ncp) in zip(timers, ncpus)]
        wtime_peff = [(min_ncpus * ref_t.cpu_time) / (t.cpu_time * ncp) for (t, ncp) in zip(timers, ncpus)]
        n = len(timers)

        peff["total"] = {}
        peff["total"]["cpu_time"] = ctime_peff
        peff["total"]["wall_time"] = wtime_peff
        peff["total"]["cpu_fract"] = n * [100]
        peff["total"]["wall_fract"] = n * [100]

        for sect_name in self.section_names():
            #print(sect_name)
            ref_sect = ref_t.get_section(sect_name)
            sects = [t.get_section(sect_name) for t in timers]
            try:
                ctime_peff = [(min_ncpus * ref_sect.cpu_time) / (s.cpu_time * ncp) for (s, ncp) in zip(sects, ncpus)]
                wtime_peff = [(min_ncpus * ref_sect.wall_time) / (s.wall_time * ncp) for (s, ncp) in zip(sects, ncpus)]
            except ZeroDivisionError:
                ctime_peff = n * [-1]
                wtime_peff = n * [-1]

            assert sect_name not in peff
            peff[sect_name] = {}
            peff[sect_name]["cpu_time"] = ctime_peff
            peff[sect_name]["wall_time"] = wtime_peff

            peff[sect_name]["cpu_fract"] = [s.cpu_fract for s in sects]
            peff[sect_name]["wall_fract"] = [s.wall_fract for s in sects]

        return ParallelEfficiency(self._filenames, min_idx, peff)
295835
def run(do_compare = true)
      old_sync, self.class.output.sync = self.class.output.sync, true
      $DEBUG and warn "Calling setup."
      setup
      run_once
      do_compare and @comparison and @comparison.display
      self
    rescue => e
      warn "Caught #{e.class}: #{e}\n\n#{e.backtrace.map { |x| "\t#{x}\n" }}"
    ensure
      $DEBUG and warn "Calling teardown."
      teardown
      @clocks and write_files
      self.class.output.sync = old_sync
    end
1192060
public static function array_next_element($arr, $nested_key, $iteration = 1)
    {
        foreach ($arr as $key => $v) {
            current($arr);

            if ($key == $nested_key) {
                for ($i = 0; $i < $iteration; $i++) {
                    $return = next($arr);
                }

                if (!empty($return)) {
                    return $return;
                } else {
                    return false;
                }
            }

            next($arr);
        }

        return false;
    }
419602
def with_timeout(do_loop=true)
      Timeout.timeout(10) do
        dead_working = @working.values.reject(&:alive?)
        if dead_working.size > 0
          dead_working.map(&:join)
        end

        yield
      end
    rescue TimeoutError
      retry if do_loop
    end
685622
def _iterate(self, delay=None, fromqt=False):
        
        self.runUntilCurrent()
        self.doIteration(delay, fromqt)
125230
def still_optimizing(self):
        """"""

        # Check if we need to give up on optimizing.
        if (self.iterations > self.max_iter) or (self.time_elapsed() > self.max_time):
            return False

        # Always optimize for at least 'min_iter' iterations.
        elif not hasattr(self, 'improvement') or (self.iterations < self.min_iter):
            return True

        # Check convergence.
        else:
            self.converged = self.improvement < self.tol
            return False if self.converged else True
891418
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) {
    return routeProgress.currentLegProgress().upComingStep() != null
      && routeProgress.currentLegProgress().upComingStep().equals(secondStep);
  }
132591
def done?
      return (
        get_jobs_by_status(Executor::STATUS_NONE).size == 0 &&
        get_jobs_by_status(Executor::STATUS_RUNNING).size == 0 &&
        get_jobs_by_status(Executor::STATUS_DONE).size > 0
      )
    end
726634
def sleep
      current_time = ::ROS::Time.now
      if @last_time > current_time
        @last_time = current_time
      end
      elapsed = current_time - @last_time
      time_to_sleep = @sleep_duration - elapsed
      if time_to_sleep.to_sec > 0.0
        time_to_sleep.sleep
      end
      @last_time = @last_time + @sleep_duration

      # detect time jumping forwards, as well as loops that are
      # inherently too slow
      if (current_time - @last_time).to_sec > @sleep_duration.to_sec * 2
        @last_time = current_time
      end
      nil
    end
485909
public boolean getWorkModified(List<TimephasedWork> list)
   {
      boolean result = false;
      for (TimephasedWork assignment : list)
      {
         result = assignment.getModified();
         if (result)
         {
            break;
         }
      }
      return result;
   }
1015359
def run
      @started_at = Time.now
      max_cycles = 1

      while true do
        if @cycle < max_cycles
          step
        else
          diff = Time.now - @started_at
          max_cycles = (diff * @clock_cycle)
        end
      end
    end