Starts an eyes timer.  Call `req.stopTimer()` at the end of the request.
13149
function startTimer(req, res, next) {
  req.mainRoutePath = req.route.path;
  req.stopTimer = eyes.start('routes.' + req.mainRoutePath + '.' + req.method);
  next();
}
599642
def end_timing(self):
        

        if self._callback != None:
            elapsed = time.perf_counter() * 1000 - self._start
            self._callback.end_timing(self._counter, elapsed)
1124067
def start(self):
        """"""

        if self._timer:
            self._timer.cancel()

        self._timer = Timer(self._timeout, self._fire)
        self._timer.start()
309159
def on_finish(self):
        
        r = self.response
        r.request_time = time.time() - self.start_time
        if self.callback:
            self.callback(r)
1103132
def stop(self, timeout=5):
        
        self.inner().stop(timeout=timeout)
        self.inner().reload()
736857
def start(self):
		
		timeout = self.timeout()
		if timeout is not None and timeout > 0:
			self.__loop.add_timeout(timedelta(0, timeout), self.stop)
		self.handler().setup_handler(self.loop())
		self.loop().start()
		self.handler().loop_stopped()
350174
def _startTimer(self, interval):
        
        if not self.__timer:
            self.__timer = QtCore.QTimer(self)
            self.__timer.setSingleShot(self.__singleShot)
            self.__timer.setInterval(interval)
            self.__timer.timeout.connect(self.timeout)
            self.__timer.destroyed.connect(self._clearTimer)

            # ensure to stop this timer when the app quits
            QtCore.QCoreApplication.instance().aboutToQuit.connect(self.__timer.stop, QtCore.Qt.QueuedConnection)
        
        self.__timer.start(interval)
865477
def stop_watch(self):
        

        if self.greenlet_watch:
            self.greenlet_watch.kill(block=False)
            self.greenlet_watch = None
924202
def start_heartbeat(self):
        """"""
        self.stop_heartbeat()

        self._heartbeat_timer = periodic.Callback(self._heartbeat,
                                                  self._heartbeat_interval,
                                                  self.server.io_loop)
        self._heartbeat_timer.start()
765660
public static void endTimer(Optional<Timer.Context> timer) {
    timer.transform(new Function<Timer.Context, Timer.Context>() {
      @Override
      public Timer.Context apply(@Nonnull Timer.Context input) {
        input.close();
        return input;
      }
    });
  }
520625
def interval_timer(interval, func, *args, **kwargs):
    '''
    '''
    stopped = Event()

    def loop():
        while not stopped.wait(interval):  # the first call is after interval
            func(*args, **kwargs)

    Thread(name='IntervalTimerThread', target=loop).start()
    return stopped.set
416428
function monitorHttp (ctx, req, res) {
  var stopwatch = ctx.timer.start()

  function endOfConnectionHandler () {
    // cached vars
    var stats = ctx.stats
    var histogram = ctx.histogram

    // capture duration
    var duration = stopwatch.end()
    stopwatch = null
    stats.meter('requests').mark()

    // duration is in ms as float with nanosecond precision,
    // but we use microseconds with the backend
    histogram.update(Math.round(duration * 1000), Date.now())
    if (res.getHeader) {
      ctx.resSize += ((res.getHeader('Content-Length') || 0) * 1)
    }

    if (req.headers) {
      ctx.reqSize += (req.headers['content-length'] || 0) * 1
    }

    // capture special response codes
    if (res.statusCode >= 300) {
      if (res.statusCode < 400) {
        stats.meter('3xxRate').mark()
      } else if (res.statusCode < 500) {
        stats.meter('errRate').mark()
        stats.meter('4xxRate').mark()
      } else {
        stats.meter('errRate').mark()
        stats.meter('5xxRate').mark()
      }
    }

    res.removeListener(FINISH_EVENT_NAME, endOfConnectionHandler)
    res.removeListener(ABRUPT_CLOSE_EVENT_NAME, endOfConnectionHandler)

    // this is invoked to cleanup domains from possible timers bound to it
    cleanDomainNamespace()
  }

  res.on(FINISH_EVENT_NAME, endOfConnectionHandler)
  res.on(ABRUPT_CLOSE_EVENT_NAME, endOfConnectionHandler)
}
519441
public void startTimer()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    	SibTr.entry(tc, "startTimer");
    btmLockManager.lockExclusive();
    try
    {
      //only start if currently stopped
      if (isStopped)
      {
        //set stopped to false
        isStopped = false;
        //iterate over the entries currently in the active list
        LinkedListEntry entry = (LinkedListEntry) activeEntries.getFirst();
        while(entry != null && activeEntries.contains(entry))
        {
          //start an alarm for each entry
          startNewAlarm(entry);
          entry = (LinkedListEntry) entry.getNext();
        }
      }
    }
    finally
    {
      btmLockManager.unlockExclusive();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    	SibTr.exit(tc, "startTimer");
  }
184317
public void start()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "start");

    synchronized (this)
    {
      _stopped = false;
    }

    // start all the liveness timers
    _eagerGetTOM.startTimer();
    _slowedGetTOM.startTimer();
    _initialAcceptedTOM.startTimer();
    _acceptedTOM.startTimer();
    _rejectedTOM.startTimer();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "start");
  }
931573
function Timer(timeout, timeoutCallback) {
  this.finalTime = false;
  this.time = Date.now();
  this.TimerFunction = setTimeout(timeoutCallback, timeout);
}
1352280
def _wait_for(self, callback, timeout=None):
        '''
        
        '''
        start = time.time()
        while True:
            if callback():
                return
            elapsed = time.time() - start
            if timeout and elapsed > timeout:
                raise BrowsingTimeout(
                        'timed out after %.1fs waiting for: %s' % (
                            elapsed, callback))
            brozzler.sleep(self._wait_interval)
487550
def on_timer(self):
        
        try:
            self.flush()
        except Exception as e:
            log.exception('Error while flushing: %s', e)
        self._set_timer()