parseNFSBytesStats parses a NFSBytesStats line using an input set of integer fields.
(ss []string)
| 462 | // parseNFSBytesStats parses a NFSBytesStats line using an input set of |
| 463 | // integer fields. |
| 464 | func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) { |
| 465 | if len(ss) != fieldBytesLen { |
| 466 | return nil, fmt.Errorf("%w: Invalid NFS bytes stats: %v", ErrFileParse, ss) |
| 467 | } |
| 468 | |
| 469 | ns := make([]uint64, 0, fieldBytesLen) |
| 470 | for _, s := range ss { |
| 471 | n, err := strconv.ParseUint(s, 10, 64) |
| 472 | if err != nil { |
| 473 | return nil, err |
| 474 | } |
| 475 | |
| 476 | ns = append(ns, n) |
| 477 | } |
| 478 | |
| 479 | return &NFSBytesStats{ |
| 480 | Read: ns[0], |
| 481 | Write: ns[1], |
| 482 | DirectRead: ns[2], |
| 483 | DirectWrite: ns[3], |
| 484 | ReadTotal: ns[4], |
| 485 | WriteTotal: ns[5], |
| 486 | ReadPages: ns[6], |
| 487 | WritePages: ns[7], |
| 488 | }, nil |
| 489 | } |
| 490 | |
| 491 | // parseNFSEventsStats parses a NFSEventsStats line using an input set of |
| 492 | // integer fields. |
no outgoing calls
no test coverage detected