MCPcopy Create free account
hub / github.com/facebook/time / pollOnce

Function pollOnce

sa53/cmd/poll.go:295–317  ·  view source on GitHub ↗

pollOnce gathers all params for a single tick. Returns the CSV row (ISO timestamp, ns timestamp, then each value or "ERR: ") and allErrored=true if every parameter failed.

(sa53 *protocol.Mac, params []string, rl *rawlog.Logger)

Source from the content-addressed store, hash-verified

293// (ISO timestamp, ns timestamp, then each value or "ERR:<msg>") and
294// allErrored=true if every parameter failed.
295func pollOnce(sa53 *protocol.Mac, params []string, rl *rawlog.Logger) (row []string, allErrored bool) {
296 row = make([]string, 0, len(params)+2)
297 now := time.Now()
298 row = append(row, now.UTC().Format(time.RFC3339Nano))
299 row = append(row, strconv.FormatInt(now.UnixNano(), 10))
300 errCount := 0
301 for _, p := range params {
302 mark(rl, "get "+p)
303 v, err := sa53.Get(p)
304 if err != nil {
305 row = append(row, "ERR:"+err.Error())
306 errCount++
307 // Drain only when bytes might still be in flight. A clean
308 // device error ([!N]) means the response is complete.
309 if !errors.Is(err, protocol.ErrDeviceError) {
310 sa53.Drain()
311 }
312 continue
313 }
314 row = append(row, v)
315 }
316 return row, errCount == len(params)
317}
318
319// runPollSingleCmd opens the port, sends a single raw command, prints the
320// response, and returns. Useful for one-off probes like \{swrev?} for

Callers 1

runPollFunction · 0.85

Calls 4

markFunction · 0.85
GetMethod · 0.45
ErrorMethod · 0.45
DrainMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…