MCPcopy Index your code
hub / github.com/docker/docker-agent / SetUsage

Method SetUsage

pkg/session/session.go:554–559  ·  view source on GitHub ↗

SetUsage records cumulative input/output token counts under s.mu. The runtime stream goroutine and the persistence observer race on these fields without it.

(input, output int64)

Source from the content-addressed store, hash-verified

552// The runtime stream goroutine and the persistence observer race on
553// these fields without it.
554func (s *Session) SetUsage(input, output int64) {
555 s.mu.Lock()
556 defer s.mu.Unlock()
557 s.InputTokens = input
558 s.OutputTokens = output
559}
560
561// Usage returns a consistent snapshot of the cumulative input/output
562// token counts.

Callers 2

handleStreamFunction · 0.80

Implementers 7

fakeSessionpkg/tools/lifecycle/supervisor_test.go
sessionClientpkg/tools/mcp/session_client.go
mockMCPClientpkg/tools/mcp/mcp_test.go
reconnectableMockClientpkg/tools/mcp/mcp_test.go
failingInitClientpkg/tools/mcp/reconnect_test.go
clientSessionpkg/tools/mcp/mcp.go
lspSessionpkg/tools/builtin/lsp/lsp_lifecycle.go

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected