MCPcopy Index your code
hub / github.com/docker/cli / SetErrorAndReset

Method SetErrorAndReset

cli/command/container/formatter_stats.go:63–77  ·  view source on GitHub ↗

SetErrorAndReset zeroes all the container statistics and store the error. It is used when receiving time out error during statistics collecting to reduce lock overhead

(err error)

Source from the content-addressed store, hash-verified

61// SetErrorAndReset zeroes all the container statistics and store the error.
62// It is used when receiving time out error during statistics collecting to reduce lock overhead
63func (cs *Stats) SetErrorAndReset(err error) {
64 cs.mutex.Lock()
65 defer cs.mutex.Unlock()
66 cs.CPUPercentage = 0
67 cs.Memory = 0
68 cs.MemoryPercentage = 0
69 cs.MemoryLimit = 0
70 cs.NetworkRx = 0
71 cs.NetworkTx = 0
72 cs.BlockRead = 0
73 cs.BlockWrite = 0
74 cs.PidsCurrent = 0
75 cs.err = err
76 cs.IsInvalid = true
77}
78
79// SetError sets container statistics error
80func (cs *Stats) SetError(err error) {

Callers 1

collectFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected