// ElapsedMilliSeconds returns the elapsed time in milliseconds of
// the named stopwatch if it exists or 0.
503724
func (ns *NamedStopwatch) ElapsedMilliSeconds(name string) float64 {
	if ns == nil {
		return float64(0)
	}
	ns.RLock()
	defer ns.RUnlock()

	if s, ok := ns.stopwatches[name]; ok {
		return s.ElapsedMilliSeconds()
	}
	return float64(0)
}
87740
func MillisecondsSince(t time.Time) int {
	return int(time.Since(t) / time.Millisecond)
}
462655
func (t *Timer) Stop() bool {
	if t.timer != nil {
		return t.timer.Stop()
	}

	registered := !t.stopped
	t.mock.removeClockTimer((*internalTimer)(t))
	t.stopped = true
	return registered
}
41650
func (d *DefaultMetricCollector) TotalDuration() *rolling.Timing {
	d.mutex.RLock()
	defer d.mutex.RUnlock()
	return d.totalDuration
}
948521
func stoppedTimer() *time.Timer {
	timer := time.NewTimer(0)
	if !timer.Stop() {
		<-timer.C
	}
	return timer
}
1089282
func (s *Stopwatch) Start() {
	s.Lock()
	defer s.Unlock()

	if !s.isRunning() {
		s.refTime = time.Now()
	}
}
1117793
func NewTimerMetrics(statusEvery int, prefix string) *TimerMetrics {
	s := &TimerMetrics{
		statusEvery: statusEvery,
		prefix:      prefix,
	}
	if statusEvery > 0 {
		if statusEvery < 100 {
			log.Printf("Warning: use more than 100 status values for accurate percentiles (configured with %d)", statusEvery)
		}
		s.timings = make(durations, 0, statusEvery)
	}
	return s
}
975565
func (ns *NamedStopwatch) AddElapsedSince(name string, t time.Time) {
	if ns == nil {
		return
	}
	ns.Lock()
	defer ns.Unlock()

	if s, ok := ns.stopwatches[name]; ok {
		s.AddElapsedSince(t)
	}
}
1207033
func (s *GetIntegrationOutput) SetTimeoutInMillis(v int64) *GetIntegrationOutput {
	s.TimeoutInMillis = &v
	return s
}
105720
func elapsedTime(p *process.Process) (string, error) {
	crtTime, err := p.CreateTime()
	if err != nil {
		return "", err
	}
	etime := time.Since(time.Unix(int64(crtTime/1000), 0))
	return fmtEtimeDuration(etime), nil
}
531439
func (s *GetGroupCertificateConfigurationOutput) SetCertificateAuthorityExpiryInMilliseconds(v string) *GetGroupCertificateConfigurationOutput {
	s.CertificateAuthorityExpiryInMilliseconds = &v
	return s
}
259605
func (tm *Timer) Stop() {
	tm.mu.Lock()
	defer tm.mu.Unlock()
	if tm.running {
		tm.msg <- timerStop
		tm.running = false
	}
}
1040286
func (f *TimeFuncs) Microsecond(n interface{}) gotime.Duration {
	return gotime.Microsecond * gotime.Duration(conv.ToInt64(n))
}
977848
func (c *C) StartTimer() {
	if !c.timerOn {
		c.start = time.Now()
		c.timerOn = true

		runtime.ReadMemStats(&memStats)
		c.startAllocs = memStats.Mallocs
		c.startBytes = memStats.TotalAlloc
	}
}
357948
func GetElapsedTime(o dhcp6.Options) (ElapsedTime, error) {
	v, err := o.GetOne(dhcp6.OptionElapsedTime)
	if err != nil {
		return 0, err
	}

	var t ElapsedTime
	err = (&t).UnmarshalBinary(v)
	return t, err
}
256513
func (c *connectionBenchmark) runRateLimited() (time.Duration, error) {
	var (
		interval = c.expectedInterval.Nanoseconds()
		stop     = time.After(c.duration)
		start    = time.Now()
		limit    = rate.Every(c.expectedInterval)
		limiter  = rate.NewLimiter(limit, c.burst)
		ctx      = context.Background()
	)
	for {
		select {
		case <-stop:
			return time.Since(start), nil
		default:
		}

		limiter.WaitN(ctx, c.burst)
		for i := 0; i < c.burst; i++ {
			before := time.Now()
			err := c.requester.Request()
			latency := time.Since(before).Nanoseconds()
			if err != nil {
				if err := c.errorHistogram.RecordCorrectedValue(latency, interval); err != nil {
					return 0, err
				}
				if err := c.uncorrectedErrorHistogram.RecordValue(latency); err != nil {
					return 0, err
				}
				c.errorTotal++
			} else {
				if err := c.successHistogram.RecordCorrectedValue(latency, interval); err != nil {
					return 0, err
				}
				if err := c.uncorrectedSuccessHistogram.RecordValue(latency); err != nil {
					return 0, err
				}
				c.successTotal++
			}
		}
	}
}
1285369
func (s *Client) TimingDuration(stat string, delta time.Duration, rate float32) error {
	if !s.includeStat(rate) {
		return nil
	}

	ms := float64(delta) / float64(time.Millisecond)
	return s.submit(stat, "", ms, "|ms", rate)
}