// UsageStats calculates aggregate usage for the object.
515082
func (p *podEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error) {
	return generic.CalculateUsageStats(options, p.listFuncByNamespace, podMatchesScopeFunc, p.Usage)
}
52920
func (tc *TabletStatsCache) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, error) {
	e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType)
	if e == nil {
		return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target))
	}

	e.mu.RLock()
	defer e.mu.RUnlock()
	if target.TabletType == topodatapb.TabletType_MASTER {
		if len(e.aggregates) == 0 {
			return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target))
		}
		for _, agg := range e.aggregates {
			return agg, nil
		}
	}
	targetAlias := tc.getAliasByCell(target.Cell)
	agg, ok := e.aggregates[targetAlias]
	if !ok {
		return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target))
	}
	return agg, nil
}
529141
func (container *container) Statistics() (Statistics, error) {
	properties, err := container.system.Properties(schema1.PropertyTypeStatistics)
	if err != nil {
		return Statistics{}, convertSystemError(err, container)
	}

	return properties.Statistics, nil
}
571932
func (c *Controller) Stats() map[string]interface{} {
	result := CurrentEngine.Stats()
	if RevelConfig.Controller.Reuse {
		result["revel-controllers"] = RevelConfig.Controller.Stack.String()
		for key, appStack := range RevelConfig.Controller.CachedMap {
			result["app-" + key] = appStack.String()
		}
	}
	return result
}
246656
func (it *And) Stats() graph.IteratorStats {
	stats := getStatsForSlice(it.SubIterators())
	stats.Next = it.runstats.Next
	stats.Contains = it.runstats.Contains
	return stats
}
1243893
func (db *CLevelDB) Stats() map[string]string {
	keys := []string{
		"leveldb.aliveiters",
		"leveldb.alivesnaps",
		"leveldb.blockpool",
		"leveldb.cachedblock",
		"leveldb.num-files-at-level{n}",
		"leveldb.openedtables",
		"leveldb.sstables",
		"leveldb.stats",
	}

	stats := make(map[string]string, len(keys))
	for _, key := range keys {
		str := db.db.PropertyValue(key)
		stats[key] = str
	}
	return stats
}
1045623
func (c *MiniClient) Statistics() MiniStats {
	c.bSwapLock.Lock()
	defer c.bSwapLock.Unlock()

	return unsyncStats(c.b)
}
1265173
func (c *Client) SessionStats() (stats *SessionStats, err error) {
	if err = c.rpcCall("session-stats", nil, &stats); err != nil {
		err = fmt.Errorf("'session-stats' rpc method failed: %v", err)
	}
	return
}
1012496
func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationStatsMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
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
}
684452
func (*HandlerT) GcStats() *debug.GCStats {
	s := new(debug.GCStats)
	debug.ReadGCStats(s)
	return s
}
1361065
func (d *devicePluginClient) Stats(ctx context.Context, interval time.Duration) (<-chan *StatsResponse, error) {
	// Join the passed context and the shutdown context
	joinedCtx, _ := joincontext.Join(ctx, d.doneCtx)

	req := proto.StatsRequest{
		CollectionInterval: ptypes.DurationProto(interval),
	}
	stream, err := d.client.Stats(joinedCtx, &req)
	if err != nil {
		return nil, grpcutils.HandleReqCtxGrpcErr(err, ctx, d.doneCtx)
	}

	out := make(chan *StatsResponse, 1)
	go d.handleStats(ctx, stream, out)
	return out, nil
}
612214
func (a *Application) Usage(args []string) {
	context, err := a.parseContext(true, args)
	a.FatalIfError(err, "")
	if err := a.UsageForContextWithTemplate(context, 2, a.usageTemplate); err != nil {
		panic(err)
	}
}
1072013
func (s *VolumeServer) Stats(
	ctx context.Context,
	req *api.SdkVolumeStatsRequest,
) (*api.SdkVolumeStatsResponse, error) {
	if s.cluster() == nil || s.driver(ctx) == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if len(req.GetVolumeId()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
	}

	// Get access rights
	if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
		return nil, err
	}

	stats, err := s.driver(ctx).Stats(req.GetVolumeId(), !req.GetNotCumulative())
	if err != nil {
		return nil, status.Errorf(
			codes.Internal,
			"Failed to obtain stats for volume %s: %v",
			req.GetVolumeId(),
			err.Error())
	}

	return &api.SdkVolumeStatsResponse{
		Stats: stats,
	}, nil
}
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),
	}
}
1322881
func (c *Command) UsageString() string {
	return fmt.Sprintf("usage:\n\n\t$ badwolf %s\n\n%s\n", c.UsageLine, strings.TrimSpace(c.Long))
}
207623
func hasUsageStats(resourceQuota *corev1.ResourceQuota, interestingResources []corev1.ResourceName) bool {
	interestingSet := quota.ToSet(interestingResources)
	for resourceName := range resourceQuota.Status.Hard {
		if !interestingSet.Has(string(resourceName)) {
			continue
		}
		if _, found := resourceQuota.Status.Used[resourceName]; !found {
			return false
		}
	}
	return true
}