MCPcopy Index your code
hub / github.com/google/gops / formatBytes

Function formatBytes

agent/agent.go:192–205  ·  view source on GitHub ↗
(val uint64)

Source from the content-addressed store, hash-verified

190}
191
192func formatBytes(val uint64) string {
193 var i int
194 var target uint64
195 for i = range units {
196 target = 1 << uint(10*(i+1))
197 if val < target {
198 break
199 }
200 }
201 if i > 0 {
202 return fmt.Sprintf("%0.2f%s (%d bytes)", float64(val)/(float64(target)/1024), units[i], val)
203 }
204 return fmt.Sprintf("%d bytes", val)
205}
206
207func handle(conn io.ReadWriter, msg []byte) error {
208 switch msg[0] {

Callers 2

TestFormatBytesFunction · 0.85
handleFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatBytesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…