go/src/cmd/vendor/golang.org/x/telemetry/internal/counter/counter.go

var debugCounter

var CrashOnBugs

// debugPrintf formats a debug message if GODEBUG=countertrace=1.
func debugPrintf(format string, args ...any) {}

// debugFatalf logs a fatal error if GODEBUG=countertrace=1.
func debugFatalf(format string, args ...any) {}

type Counter

func (c *Counter) Name() string {}

type counterPtr

type counterState

func (s *counterState) load() counterStateBits {}

func (s *counterState) update(old *counterStateBits, new counterStateBits) bool {}

type counterStateBits

const stateReaders

const stateLocked

const stateHavePtr

const stateExtraShift

const stateExtra

func (b counterStateBits) readers() int  {}

func (b counterStateBits) locked() bool  {}

func (b counterStateBits) havePtr() bool {}

func (b counterStateBits) extra() uint64 {}

func (b counterStateBits) incReader() counterStateBits    {}

func (b counterStateBits) decReader() counterStateBits    {}

func (b counterStateBits) setLocked() counterStateBits    {}

func (b counterStateBits) clearLocked() counterStateBits  {}

func (b counterStateBits) setHavePtr() counterStateBits   {}

func (b counterStateBits) clearHavePtr() counterStateBits {}

func (b counterStateBits) clearExtra() counterStateBits   {}

func (b counterStateBits) addExtra(n uint64) counterStateBits {}

// New returns a counter with the given name.
// New can be called in global initializers and will be compiled down to
// linker-initialized data. That is, calling New to initialize a global
// has no cost at program startup.
func New(name string) *Counter {}

// Inc adds 1 to the counter.
func (c *Counter) Inc() {}

// Add adds n to the counter. n cannot be negative, as counts cannot decrease.
func (c *Counter) Add(n int64) {}

func (c *Counter) releaseReader(state counterStateBits) {}

func (c *Counter) releaseLock(state counterStateBits) {}

// add wraps the atomic.Uint64.Add operation to handle integer overflow.
func (c *Counter) add(n uint64) uint64 {}

func (c *Counter) invalidate() {}

func (c *Counter) refresh() {}

// Read reads the given counter.
// This is the implementation of x/telemetry/counter/countertest.ReadCounter.
func Read(c *Counter) (uint64, error) {}

func readFile(f *file) (*File, error) {}

// ReadFile reads the counters and stack counters from the given file.
// This is the implementation of x/telemetry/counter/countertest.ReadFile.
func ReadFile(name string) (counters, stackCounters map[string]uint64, _ error) {}

// ReadMapped reads the contents of the given file by memory mapping.
//
// This avoids file synchronization issues.
func ReadMapped(name string) ([]byte, error) {}