// tick runs a ticker to purge the bucket
483422
func (b *Bucket) tick() {
	var t = time.NewTicker(b.period)
	defer t.Stop()
	for {
		select {
		case <-t.C:
			b.count = 0
		case <-b.channelQuit:
			return
		}
	}
}
647741
func (p *Player) Tick(t int64) {
	if t%util.Ticks(50) == 0 {
		r := &packet.KeepAlive{RandomId: rand.Int31()}
		r.WriteTo(p.Conn)
	}
}
1181312
func (t *Ticker) Run() {
	var (
		i, priorPos, pos, line, fieldNum int
		n                                uint64
		f                                float64
		v                                byte
		la                              LoadAvg
		err                              error
	)
	// ticker
	for {
		select {
		case <-t.Done:
			return
		case <-t.C:
			la.Timestamp = time.Now().UTC().UnixNano()
			err = t.Reset()
			line = 0
		tick:
			for {
				t.Line, err = t.ReadSlice('\n')
				if err != nil {
					if err == io.EOF {
						break
					}
					t.Errs <- &joe.ReadError{Err: err}
					break
				}
				line++
				for {
					// space delimits the values
					for i, v = range t.Line[pos:] {
						if v == 0x20 {
							priorPos, pos = pos, pos+i+1
							break
						}
					}
					fieldNum++
					if fieldNum <= 3 {
						f, err = strconv.ParseFloat(string(t.Line[priorPos:pos-1]), 64)
						if err != nil {
							t.Errs <- &joe.ParseError{Info: fmt.Sprintf("line %d: field %d", line, fieldNum), Err: err}
							break tick
						}
						if fieldNum == 1 {
							la.Minute = float32(f)
							continue
						}
						if fieldNum == 2 {
							la.Five = float32(f)
							continue
						}
						la.Fifteen = float32(f)
						continue
					}
					if fieldNum == 4 {
						// get the process information: separated by /
						for i, v = range t.Line[priorPos:pos] {
							if v == '/' {
								break
							}
						}
						n, err = helpers.ParseUint(t.Line[priorPos : priorPos+i])
						if err != nil {
							t.Errs <- &joe.ParseError{Info: fmt.Sprintf("line %d: field %d", line, fieldNum), Err: err}
							break tick
						}
						la.Running = int32(n)
						n, err = helpers.ParseUint(t.Line[priorPos+i+1 : pos-1])
						if err != nil {
							t.Errs <- &joe.ParseError{Info: fmt.Sprintf("line %d: field %d", line, fieldNum), Err: err}
							break tick
						}
						la.Total = int32(n)
						continue
					}
					n, err = helpers.ParseUint(t.Line[pos : len(t.Line)-1])
					if err != nil {
						t.Errs <- &joe.ParseError{Info: fmt.Sprintf("line %d: field %d", line, fieldNum), Err: err}
						break tick
					}
					la.PID = int32(n)
					break
				}
			}
			t.Data <- la
		}
	}
}
610127
func (c *PeekCall) Bucket(bucket ...string) *PeekCall {
	c.urlParams_.SetMulti("bucket", append([]string{}, bucket...))
	return c
}
567272
func (l Tickers) TickAll(tick int64) {
	l.RLock()
	for _, t := range l.list {
		t.Tick(tick)
	}
	l.RUnlock()
}
423529
func (tab *Table) bucket(id enode.ID) *bucket {
	d := enode.LogDist(tab.self().ID(), id)
	if d <= bucketMinDistance {
		return tab.buckets[0]
	}
	return tab.buckets[d-bucketMinDistance-1]
}
1187736
func (a *StandardEWMA) Tick() {
	count := atomic.LoadInt64(&a.uncounted)
	atomic.AddInt64(&a.uncounted, -count)
	instantRate := float64(count) / float64(5e9)
	a.mutex.Lock()
	defer a.mutex.Unlock()
	if a.init {
		a.rate += a.alpha * (instantRate - a.rate)
	} else {
		a.init = true
		a.rate = instantRate
	}
}
42205
func (t *Ticker) Stop() {
	if t.ticker != nil {
		t.ticker.Stop()
	} else {
		t.mock.removeClockTimer((*internalTicker)(t))
	}
}
28010
func (f *Factory) Timer(options metrics.TimerOptions) metrics.Timer {
	help := strings.TrimSpace(options.Help)
	if len(help) == 0 {
		help = options.Name
	}
	name := f.subScope(options.Name)
	tags := f.mergeTags(options.Tags)
	labelNames := f.tagNames(tags)
	opts := prometheus.HistogramOpts{
		Name:    name,
		Help:    help,
		Buckets: asFloatBuckets(options.Buckets),
	}
	hv := f.cache.getOrMakeHistogramVec(opts, labelNames)
	return &timer{
		histogram: hv.WithLabelValues(f.tagsAsLabelValues(labelNames, tags)...),
	}
}
509293
func (c *Counter) Flush(interval time.Duration) []InterMetric {
	tags := make([]string, len(c.Tags))
	copy(tags, c.Tags)
	return []InterMetric{{
		Name:      c.Name,
		Timestamp: time.Now().Unix(),
		Value:     float64(c.value),
		Tags:      tags,
		Type:      CounterMetric,
		Sinks:     routeInfo(tags),
	}}
}
407014
func (s Linear) TicksAtLevel(level int) interface{} {
	return linearTicker{&s, false}.TicksAtLevel(level)
}
306346
func (t *Tx) Bucket(b []byte) (kv.Bucket, error) {
	return t.BucketFn(b)
}
248495
func (c *Cluster) Bucket(bucketName string, opts *BucketOptions) *Bucket {
	if opts == nil {
		opts = &BucketOptions{}
	}
	b := newBucket(&c.sb, bucketName, *opts)
	b.connect()
	return b
}
211175
func (c *CassandraBackend) bucket(key string) string {
	bs := c.buckets(key)
	return bs[len(bs)-1]
}
293223
func Tickmarks(min, max float64) (list []float64, precision int) {
	if max > min {
		spread := niceNum(max-min, false)
		d := niceNum((spread / 4), true)
		graphMin := math.Floor(min/d) * d
		graphMax := math.Ceil(max/d) * d
		precision = TickmarkPrecision(d)
		for x := graphMin; x < graphMax+0.5*d; x += d {
			list = append(list, x)
		}
	}
	return
}
903245
func (t *T) Ticks() <-chan time.Time {
	if t.ticker == nil {
		return nil
	}
	return t.ticker.C
}
1014634
func (l Tickers) Copy() map[int32]tick.Ticker {
	lc := make(map[int32]tick.Ticker)
	l.RLock()
	for k, t := range l.list {
		lc[k] = t
	}
	l.RUnlock()
	return lc
}