// ReferenceStats returns the index statistics for the given reference and true
// if the statistics are valid.
7934
func (i *Index) ReferenceStats(id int) (stats index.ReferenceStats, ok bool) {
	s := i.refs[id].stats
	if s == nil {
		return index.ReferenceStats{}, false
	}
	return *s, true
}
390617
func (repo *Repository) IssueStats(userID int64, filterMode FilterMode, isPull bool) (int64, int64) {
	return GetRepoIssueStats(repo.ID, userID, filterMode, isPull)
}
865794
func GetStats() (stats Stats, err error) {
	stats.TotalRAM, err = getHwPhysmem()
	return stats, err
}
489859
func (s *Spec) AllRefs() (result []spec.Ref) {
	set := make(map[string]struct{})
	for _, v := range s.references.allRefs {
		a := v.String()
		if a == "" {
			continue
		}
		if _, ok := set[a]; !ok {
			set[a] = struct{}{}
			result = append(result, v)
		}
	}
	return
}
164338
func (srv *Instance) Stats() agents.ServerStats {
	return agents.ServerStats{
		Total:      srv.getPromCtrValue(totalCtr),
		Valid:      srv.getPromCtrValue(validatedCtr),
		Invalid:    srv.getPromCtrValue(unvalidatedCtr),
		Passed:     srv.getPromCtrValue(passedCtr),
		Filtered:   srv.getPromCtrValue(filteredCtr),
		Replies:    srv.getPromCtrValue(repliesCtr),
		TTLExpired: srv.getPromCtrValue(ttlExpiredCtr),
	}
}
1006942
func (ct *costTracker) updateStats(code, amount, servingTime, realCost uint64) {
	avg := reqAvgTimeCost[code]
	avgTime := avg.baseCost + amount*avg.reqCost
	select {
	case ct.gfUpdateCh <- gfUpdate{float64(avgTime), float64(servingTime)}:
	default:
	}
	if makeCostStats {
		realCost <<= 4
		l := 0
		for l < 9 && realCost > avgTime {
			l++
			realCost >>= 1
		}
		atomic.AddUint64(&ct.stats[code][l], 1)
	}
}
1150598
func addReferences(references map[string]bool, s []byte) {
	for _, pat := range referencesPats {
		for _, m := range pat.FindAllSubmatch(s, -1) {
			p := string(m[1])
			if gosrc.IsValidRemotePath(p) {
				references[p] = true
			}
		}
	}
}
95461
func (m *model) ConnectionStats() map[string]interface{} {
	m.fmut.RLock()
	m.pmut.RLock()
	defer m.pmut.RUnlock()
	defer m.fmut.RUnlock()

	res := make(map[string]interface{})
	devs := m.cfg.Devices()
	conns := make(map[string]ConnectionInfo, len(devs))
	for device, deviceCfg := range devs {
		hello := m.helloMessages[device]
		versionString := hello.ClientVersion
		if hello.ClientName != "syncthing" {
			versionString = hello.ClientName + " " + hello.ClientVersion
		}
		ci := ConnectionInfo{
			ClientVersion: strings.TrimSpace(versionString),
			Paused:        deviceCfg.Paused,
		}
		if conn, ok := m.conn[device]; ok {
			ci.Type = conn.Type()
			ci.Crypto = conn.Crypto()
			ci.Connected = ok
			ci.Statistics = conn.Statistics()
			if addr := conn.RemoteAddr(); addr != nil {
				ci.Address = addr.String()
			}
		}

		conns[device.String()] = ci
	}

	res["connections"] = conns

	in, out := protocol.TotalInOut()
	res["total"] = ConnectionInfo{
		Statistics: protocol.Statistics{
			At:            time.Now(),
			InBytesTotal:  in,
			OutBytesTotal: out,
		},
	}

	return res
}
1182026
func Refs(c context.Context, a Authority, path string, r MultiResolver, meta *[]*config.Meta) error {
	return getAll(c, a, backend.GetAllRef, path, r, meta)
}
378467
func (a *StatsAdapter) ListStats(patterns ...string) ([]string, error) {
	var statNames []string
	for _, stat := range a.entries {
		statNames = append(statNames, stat.Name)
	}
	return statNames, nil
}
731105
func (it *LinksTo) Stats() graph.IteratorStats {
	subitStats := it.primaryIt.Stats()
	// TODO(barakmich): These should really come from the quadstore itself
	checkConstant := int64(1)
	nextConstant := int64(2)
	st := graph.IteratorStats{
		NextCost:     nextConstant + subitStats.NextCost,
		ContainsCost: checkConstant + subitStats.ContainsCost,
		Next:         it.runstats.Next,
		Contains:     it.runstats.Contains,
		ContainsNext: it.runstats.ContainsNext,
	}
	st.Size, st.ExactSize = it.Size()
	return st
}
129699
func (p *LogicalUnionAll) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error) {
	p.stats = &property.StatsInfo{
		Cardinality: make([]float64, p.Schema().Len()),
	}
	for _, childProfile := range childStats {
		p.stats.RowCount += childProfile.RowCount
		for i := range p.stats.Cardinality {
			p.stats.Cardinality[i] += childProfile.Cardinality[i]
		}
	}
	return p.stats, nil
}
144666
func (s *Spec) AllReferences() (result []string) {
	for _, v := range s.references.allRefs {
		result = append(result, v.String())
	}
	return
}
565972
func (c *Client) GetISCSIPortals() (Refs, error) {
	iSCSIPortals, err := c.api.GetISCSIPortals()
	if err != nil {
		return nil, err
	}
	return iSCSIPortals.ISCSIPortals, nil
}
1072452
func (p *BulkProcessor) Stats() BulkProcessorStats {
	p.statsMu.Lock()
	defer p.statsMu.Unlock()
	return *p.stats.dup()
}
754766
func (p *LogicalWindow) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error) {
	childProfile := childStats[0]
	p.stats = &property.StatsInfo{
		RowCount:    childProfile.RowCount,
		Cardinality: make([]float64, p.schema.Len()),
	}
	for i := 0; i < p.schema.Len()-1; i++ {
		colIdx := p.children[0].Schema().ColumnIndex(p.schema.Columns[i])
		p.stats.Cardinality[i] = childProfile.Cardinality[colIdx]
	}
	p.stats.Cardinality[p.schema.Len()-1] = childProfile.RowCount
	return p.stats, nil
}
684452
func (*HandlerT) GcStats() *debug.GCStats {
	s := new(debug.GCStats)
	debug.ReadGCStats(s)
	return s
}