// UsageStats calculates aggregate usage for the object.
348821
func (p *serviceEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error) {
	return generic.CalculateUsageStats(options, p.listFuncByNamespace, generic.MatchesNoScopeFunc, p.Usage)
}
865963
func containerUsage(podStats statsapi.PodStats, statsToMeasure []fsStatsType) v1.ResourceList {
	disk := resource.Quantity{Format: resource.BinarySI}
	inodes := resource.Quantity{Format: resource.DecimalSI}
	for _, container := range podStats.Containers {
		if hasFsStatsType(statsToMeasure, fsStatsRoot) {
			disk.Add(*diskUsage(container.Rootfs))
			inodes.Add(*inodeUsage(container.Rootfs))
		}
		if hasFsStatsType(statsToMeasure, fsStatsLogs) {
			disk.Add(*diskUsage(container.Logs))
			inodes.Add(*inodeUsage(container.Logs))
		}
	}
	return v1.ResourceList{
		v1.ResourceEphemeralStorage: disk,
		resourceInodes:              inodes,
	}
}
1348803
func (h *taskHandle) Stats(ctx context.Context, interval time.Duration) (<-chan *cstructs.TaskResourceUsage, error) {
	select {
	case <-h.doneCh:
		return nil, nstructs.NewRecoverableError(fmt.Errorf("container stopped"), false)
	default:
	}

	destCh, recvCh := newStatsChanPipe()
	go h.collectStats(ctx, destCh, interval)
	return recvCh, nil
}
580581
func WithStats(ctx context.Context, stats Stats) context.Context {
	return context.WithValue(ctx, statsKey, stats)
}
160696
func (s *Store) Stats() (map[string]interface{}, error) {
	finfos, err := ioutil.ReadDir(s.dir)
	if err != nil {
		return nil, err
	}

	var numBytesUsedDisk uint64
	for _, finfo := range finfos {
		if !finfo.IsDir() {
			numBytesUsedDisk += uint64(finfo.Size())
		}
	}

	s.m.Lock()
	totPersists := s.totPersists
	totCompactions := s.totCompactions
	totCompactionsPartial := s.totCompactionsPartial
	numLastCompactionBeforeBytes := s.numLastCompactionBeforeBytes
	numLastCompactionAfterBytes := s.numLastCompactionAfterBytes
	totCompactionDecreaseBytes := s.totCompactionDecreaseBytes
	totCompactionIncreaseBytes := s.totCompactionIncreaseBytes
	maxCompactionDecreaseBytes := s.maxCompactionDecreaseBytes
	maxCompactionIncreaseBytes := s.maxCompactionIncreaseBytes
	totCompactionBeforeBytes := s.totCompactionBeforeBytes
	totCompactionWrittenBytes := s.totCompactionWrittenBytes
	s.m.Unlock()

	footer, err := s.snapshot()
	if err != nil {
		return nil, err
	}

	var numSegments uint64
	if footer != nil {
		footer.m.Lock()
		if footer.ss != nil {
			numSegments = uint64(len(footer.ss.a))
		}
		footer.m.Unlock()
	}

	footer.Close()

	files, numFilesOpen := s.allFiles()

	return map[string]interface{}{
		"num_bytes_used_disk":              numBytesUsedDisk,
		"total_persists":                   totPersists,
		"total_compactions":                totCompactions,
		"total_compactions_partial":        totCompactionsPartial,
		"total_compaction_before_bytes":    totCompactionBeforeBytes,
		"total_compaction_written_bytes":   totCompactionWrittenBytes,
		"num_segments":                     numSegments,
		"num_last_compaction_before_bytes": numLastCompactionBeforeBytes,
		"num_last_compaction_after_bytes":  numLastCompactionAfterBytes,
		"total_compaction_decrease_bytes":  totCompactionDecreaseBytes,
		"total_compaction_increase_bytes":  totCompactionIncreaseBytes,
		"max_compaction_decrease_bytes":    maxCompactionDecreaseBytes,
		"max_compaction_increase_bytes":    maxCompactionIncreaseBytes,
		"num_files":                        len(files),
		"num_files_open":                   numFilesOpen,
		"files":                            files,
	}, nil
}
873609
func (s *BulkProcessorService) Stats(wantStats bool) *BulkProcessorService {
	s.wantStats = wantStats
	return s
}
144490
func GetStats() (stats Stats, err error) {
	var limit uint64
	limit, err = getMemoryLimit()
	if err != nil {
		return Stats{}, err
	}

	stats.TotalRAM = limit
	return stats, nil
}
75481
func (h *HostStatsCollector) Stats() *HostStats {
	h.hostStatsLock.RLock()
	defer h.hostStatsLock.RUnlock()

	if h.hostStats == nil {
		if err := h.collectLocked(); err != nil {
			h.logger.Warn("error fetching host resource usage stats", "error", err)
		}
	}

	return h.hostStats
}
78944
func (a *Application) UsageTemplate(template string) *Application {
	a.usageTemplate = template
	return a
}
1126963
func (u *User) RequestStats() {
	packet := MumbleProto.UserStats{
		Session: &u.Session,
	}
	u.client.Conn.WriteProto(&packet)
}
1203752
func (i *instanceManager) AllStats() []*device.DeviceGroupStats {
	i.deviceStatsLock.RLock()
	defer i.deviceStatsLock.RUnlock()
	return i.deviceStats
}
181651
func (c *ExpireCache) GetStats() ExpireCacheStats {
	c.mutex.Lock()
	c.stats.Size = int64(len(c.cache))
	defer func() {
		c.stats = ExpireCacheStats{}
		c.mutex.Unlock()
	}()
	return c.stats
}
1176449
func (p *Pool) Stats() PoolStats {
	p.mu.Lock()
	stats := PoolStats{
		ActiveCount:  p.active,
		IdleCount:    p.idle.count,
		WaitCount:    p.waitCount,
		WaitDuration: p.waitDuration,
	}
	p.mu.Unlock()

	return stats
}
335117
func runtimeStats() map[string]string {
	return map[string]string{
		"os":         runtime.GOOS,
		"arch":       runtime.GOARCH,
		"version":    runtime.Version(),
		"max_procs":  strconv.FormatInt(int64(runtime.GOMAXPROCS(0)), 10),
		"goroutines": strconv.FormatInt(int64(runtime.NumGoroutine()), 10),
		"cpu_count":  strconv.FormatInt(int64(runtime.NumCPU()), 10),
	}
}
246656
func (it *And) Stats() graph.IteratorStats {
	stats := getStatsForSlice(it.SubIterators())
	stats.Next = it.runstats.Next
	stats.Contains = it.runstats.Contains
	return stats
}
1329485
func (g *Group) CacheStats(which CacheType) CacheStats {
	switch which {
	case MainCache:
		return g.mainCache.stats()
	case HotCache:
		return g.hotCache.stats()
	default:
		return CacheStats{}
	}
}
960566
func NewUsageStat() *UsageStat {
	return &UsageStat{
		Bytes:  make(map[UsageType]int64),
		Blocks: make(map[UsageType]int64),
	}
}