build a new timer and add it to the set of running timers.
2174
public Timer newTimer(String opType, int sampleCount)
    {
        final Timer timer = new Timer(sampleCount);

        if (!timers.containsKey(opType))
            timers.put(opType, new ArrayList<Timer>());

        timers.get(opType).add(timer);
        return timer;
    }
499872
def _add_new_items(self, config, seen):
        ''''''
        for (key, value) in self.items():
            if key not in seen:
                self._set_value(config, key, value)
246325
protected function _updateTimers()
    {
        if(!isset($this->timer))
        {
            $start = time();

            $timer = array(
                'start' => $start,
                'last'  => $start,
                'now'   => $start
            );
        }
        else $timer = $this->timer;

        $timer['last'] = $timer['now'];
        $timer['now']  = time();

        $this->timer = $timer;
    }
1202340
@Override
  public Timer timer(String name) {
    final com.codahale.metrics.Timer timer = registry.timer(name);
    return new Timer() {

      @Override
      public Timer.Context time() {
        final com.codahale.metrics.Timer.Context timerContext = timer.time();
        return new Context() {
          @Override
          public void close() {
            timerContext.close();
          }
        };
      }

      @Override
      public void update(long duration, TimeUnit unit) {
        timer.update(duration, unit);
      }
    };
  }
1291748
def register(coordinator):
    """"""
    timer_queue = Queue.Queue()
    coordinator.register(TimerItem, timer_queue)
    coordinator.worker_threads.append(
        TimerThread(timer_queue, coordinator.input_queue))
201207
def __start_timer(self, delay):
        
        self.__timer = threading.Timer(delay, self.__reconnect)
        self.__timer.daemon = True
        self.__timer.start()
443447
def run(self):
    """"""

    if not (self._watchman and self._watchman.is_alive()):
      raise PantsService.ServiceError('watchman is not running, bailing!')

    # Enable watchman for the build root.
    self._watchman.watch_project(self._build_root)

    subscriptions = list(self._handlers.values())

    # Setup subscriptions and begin the main event firing loop.
    for handler_name, event_data in self._watchman.subscribed(self._build_root, subscriptions):
      self._state.maybe_pause()
      if self._state.is_terminating:
        break

      if event_data:
        # As we receive events from watchman, trigger the relevant handlers.
        self.fire_callback(handler_name, event_data)
1367548
def start(self, seconds=300):
        
        if self.state is TimerState.stopped:
            self.compare = time.time() + abs(seconds)
            self.state = TimerState.running
        elif self.state is TimerState.running:
            self.increase(seconds)
813151
function Timer(name, millis, descending) {
  this.name = name;
  this.initialMillis = millis;
  this.millis = millis;
  this.descending = descending;
  this.running = false;
}
996270
private void addSinkTasks() {
    Runnable sinkTasks = new Runnable() {
      @Override
      public void run() {
        while (!metricsInSinkQueue.isEmpty()) {
          metricsSink.processRecord(metricsInSinkQueue.poll());
        }
      }
    };

    slaveLooper.addTasksOnWakeup(sinkTasks);
  }
1260059
def add(self, interval, handler, arg):
        
        return lib.ztimerset_add(self._as_parameter_, interval, handler, arg)
525324
def add_in(self, delay: float, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
        
        process = Process(self, fn_process, self._gr)
        if _logger is not None:
            self._log(INFO, "add", __now=self.now(), fn=fn_process, args=args, kwargs=kwargs)
        self._schedule(delay, process.switch, *args, **kwargs)
        return process
1294524
public synchronized void add(Timer other) {
        this.numStarts += other.numStarts;
        this.totMs += other.totMs;
        this.maxSplitMs = Math.max(this.maxSplitMs, other.maxSplitMs);
        this.sumSqMs += other.sumSqMs;
    }
982838
def add!(timings)
      timings.descriptions.each{|d|
        add_cpu_time(d, timings.cpu_time(d))
        add_wall_time(d, timings.wall_time(d))
      }
    end
252393
def addSubprocess(self, fds, name, factory):
        
        self._lock.run(self._addSubprocess, self, fds, name, factory)
1358796
def RepeatTimer(interval, function, iterations=0, *args, **kwargs):
  """"""

  def __repeat_timer(interval, function, iterations, args, kwargs):
    """Inner function, run in background thread."""
    count = 0
    while iterations <= 0 or count < iterations:
      sleep(interval)
      function(*args, **kwargs)
      count += 1

  return start_new_thread(__repeat_timer, (interval, function, iterations, args, kwargs))
109011
def add_failure(self):
        
        failure_time = time.time()

        if not self.first_failure_time:
            self.first_failure_time = failure_time

        self.failures.append(failure_time)