Ends a {@link com.codahale.metrics.Timer.Context} only if it exists.
@param timer an Optional&lt;{@link com.codahale.metrics.Timer.Context}$gt;
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;
      }
    });
  }
18000
function stopTimeout(ctx) {
  assert(ctx);
  if (ctx.timer != null) {
    clearTimeout(ctx.timer);
    ctx.timer = null;
  }
  ctx.stopped = true;
}
76492
public static Timer timer(String name, String... tags) {
        return globalRegistry.timer(name, tags);
    }
160640
private void reportTimer(String name, Timer timer) {
        final Snapshot snapshot = timer.getSnapshot();
        String prefixedName = prefix(name);
        if (!snapshots.hasDescriptor(prefixedName)) {

            MetricItem.Builder builder = MetricItem.Builder.create();
            builder.duration("max", durationUnit);
            builder.duration("mean", durationUnit);
            builder.duration("min", durationUnit);
            builder.duration("stddev", durationUnit);

            builder.duration("p50", durationUnit);
            builder.duration("p75", durationUnit);
            builder.duration("p95", durationUnit);
            builder.duration("p98", durationUnit);
            builder.duration("p99", durationUnit);
            builder.duration("p95", durationUnit);
            builder.duration("p999", durationUnit);

            builder.calls("calls");

            builder.calls("m1_rate", 1, rateUnit);
            builder.calls("m5_rate", 1, rateUnit);
            builder.calls("m15_rate", 1, rateUnit);
            builder.calls("mean_rate", rateUnit);

            snapshots.setDescriptor(prefixedName, builder.build());

        }

        Map<String, Number> values = new HashMap<>();

        values.put("max", convertDuration(snapshot.getMax()));
        values.put("mean", convertDuration(snapshot.getMean()));
        values.put("min", convertDuration(snapshot.getMin()));
        values.put("stddev", convertDuration(snapshot.getStdDev()));

        values.put("p50", convertDuration(snapshot.getMedian()));
        values.put("p75", convertDuration(snapshot.get75thPercentile()));
        values.put("p95", convertDuration(snapshot.get95thPercentile()));
        values.put("p98", convertDuration(snapshot.get98thPercentile()));
        values.put("p99", convertDuration(snapshot.get99thPercentile()));
        values.put("p999", convertDuration(snapshot.get999thPercentile()));

        addMetered(timer, values, "calls");

        snapshots.addSnapshot(prefixedName, getTimestamp(), values);

    }
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);
      }
    };
  }
94353
public static function timerEnd()
    {
        Pool::createPool();

        // Disabled ?
        if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) ||
            AbstractController::$analysisInProgress ||
            Config::$disabledByPhp
        ) {
            return;
        }

        AbstractController::$analysisInProgress = true;

        static::$pool->createClass('Brainworxx\\Krexx\\Controller\\TimerController')
            ->noFatalForKrexx()
            ->timerEndAction()
            ->reFatalAfterKrexx();

        AbstractController::$analysisInProgress = false;
    }
565070
def end_timing(self, name, elapsed):
        
        for counter in self._counters:
            if isinstance(counter, ITimingCallback):
                counter.end_timing(name, elapsed)
512050
public void end() {
		ProfilingTimerNode currentNode = current.get();
		if (currentNode != null) {
			currentNode.stop();
			current.set(currentNode.parent);
		}
	}
195638
def OnTimerToggle(self, event):
        """"""

        if self.grid.timer_running:
            # Stop timer
            self.grid.timer_running = False
            self.grid.timer.Stop()
            del self.grid.timer

        else:
            # Start timer
            self.grid.timer_running = True
            self.grid.timer = wx.Timer(self.grid)
            self.grid.timer.Start(config["timer_interval"])
991131
@Override
  public void onTimer(String timerName) {
    if (timerName.equals(IDLE_SESSION_TIMER_NAME)) {
      checkIdleAppSession();
    }
    else if (timerName.equals(TCC_TIMER_NAME)) {
      new TccScheduledTask(this).run();
    }
    else {
      logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId());
    }
  }
971133
public function stop(int $duration = null)
    {
        // Stop the Timer
        $this->timer->stop();

        // Store Summary
        $this->summary['duration']  = $duration ?? round($this->timer->getDurationInMilliseconds(), 3);
        $this->summary['headers']   = (function_exists('xdebug_get_headers') === true) ? xdebug_get_headers() : [];
        $this->summary['backtrace'] = debug_backtrace($this->backtraceLimit);
    }
1197685
public static Timer newTimer(String name, TaggingContext context) {
    return newTimer(name, TimeUnit.MILLISECONDS, context);
  }
379020
function _stopTimer(timer, options) {
        if (timer) {
          options.timeLimit = _getTimeLeft(timer);
          clearTimeout(timer);
        }
      }
661560
public static TraceEvent endDuration(Object... args) {
        return new TraceEvent(TraceEventType.DURATION_END, null, null, args);
    }
51069
public function endTiming($metric, array $tags = array())
    {
        $timer_start = $this->metricTiming[$metric];
        $timer_end = microtime(true);
        $time = round(($timer_end - $timer_start) * 1000, 4);
        return $this->timing($metric, $time, $tags);
    }
289662
public final void setDuration(int duration) {
        if (isComplete()) {
            this.getLogger()
                    .warn(
                            "{} is already closed, the new duration of {} will be ignored on: {}",
                            this.getClass().getSimpleName(),
                            duration,
                            this);
            return;
        }
        this.duration = duration;
    }
206558
public S animate(Timer timer)
	{
		long elapsed = timer.elapsedTime() - Timer.tickToTime(delay);
		started = elapsed > transform.getDelay();
		finished = elapsed > transform.totalDuration() && transform.getLoops() != -1;

		if (!started && !renderBefore)
			return null;
		if (finished && !renderAfter)
			return null;

		transform.transform(transformable, elapsed);
		return transformable;
	}