|
0 |
package procfs
|
|
1 |
|
|
2 |
// While implementing parsing of /proc/[pid]/mountstats, this blog was used
|
|
3 |
// heavily as a reference:
|
|
4 |
// https://utcc.utoronto.ca/~cks/space/blog/linux/NFSMountstatsIndex
|
|
5 |
//
|
|
6 |
// Special thanks to Chris Siebenmann for all of his posts explaining the
|
|
7 |
// various statistics available for NFS.
|
|
8 |
|
|
9 |
import (
|
|
10 |
"bufio"
|
|
11 |
"fmt"
|
|
12 |
"io"
|
|
13 |
"strconv"
|
|
14 |
"strings"
|
|
15 |
"time"
|
|
16 |
)
|
|
17 |
|
|
18 |
// Constants shared between multiple functions.
|
|
19 |
const (
|
|
20 |
deviceEntryLen = 8
|
|
21 |
|
|
22 |
fieldBytesLen = 8
|
|
23 |
fieldEventsLen = 27
|
|
24 |
|
|
25 |
statVersion10 = "1.0"
|
|
26 |
statVersion11 = "1.1"
|
|
27 |
|
|
28 |
fieldTransport10Len = 10
|
|
29 |
fieldTransport11Len = 13
|
|
30 |
)
|
|
31 |
|
|
32 |
// A Mount is a device mount parsed from /proc/[pid]/mountstats.
|
|
33 |
type Mount struct {
|
|
34 |
// Name of the device.
|
|
35 |
Device string
|
|
36 |
// The mount point of the device.
|
|
37 |
Mount string
|
|
38 |
// The filesystem type used by the device.
|
|
39 |
Type string
|
|
40 |
// If available additional statistics related to this Mount.
|
|
41 |
// Use a type assertion to determine if additional statistics are available.
|
|
42 |
Stats MountStats
|
|
43 |
}
|
|
44 |
|
|
45 |
// A MountStats is a type which contains detailed statistics for a specific
|
|
46 |
// type of Mount.
|
|
47 |
type MountStats interface {
|
|
48 |
mountStats()
|
|
49 |
}
|
|
50 |
|
|
51 |
// A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts.
|
|
52 |
type MountStatsNFS struct {
|
|
53 |
// The version of statistics provided.
|
|
54 |
StatVersion string
|
|
55 |
// The age of the NFS mount.
|
|
56 |
Age time.Duration
|
|
57 |
// Statistics related to byte counters for various operations.
|
|
58 |
Bytes NFSBytesStats
|
|
59 |
// Statistics related to various NFS event occurrences.
|
|
60 |
Events NFSEventsStats
|
|
61 |
// Statistics broken down by filesystem operation.
|
|
62 |
Operations []NFSOperationStats
|
|
63 |
// Statistics about the NFS RPC transport.
|
|
64 |
Transport NFSTransportStats
|
|
65 |
}
|
|
66 |
|
|
67 |
// mountStats implements MountStats.
|
|
68 |
func (m MountStatsNFS) mountStats() {}
|
|
69 |
|
|
70 |
// A NFSBytesStats contains statistics about the number of bytes read and written
|
|
71 |
// by an NFS client to and from an NFS server.
|
|
72 |
type NFSBytesStats struct {
|
|
73 |
// Number of bytes read using the read() syscall.
|
|
74 |
Read int
|
|
75 |
// Number of bytes written using the write() syscall.
|
|
76 |
Write int
|
|
77 |
// Number of bytes read using the read() syscall in O_DIRECT mode.
|
|
78 |
DirectRead int
|
|
79 |
// Number of bytes written using the write() syscall in O_DIRECT mode.
|
|
80 |
DirectWrite int
|
|
81 |
// Number of bytes read from the NFS server, in total.
|
|
82 |
ReadTotal int
|
|
83 |
// Number of bytes written to the NFS server, in total.
|
|
84 |
WriteTotal int
|
|
85 |
// Number of pages read directly via mmap()'d files.
|
|
86 |
ReadPages int
|
|
87 |
// Number of pages written directly via mmap()'d files.
|
|
88 |
WritePages int
|
|
89 |
}
|
|
90 |
|
|
91 |
// A NFSEventsStats contains statistics about NFS event occurrences.
|
|
92 |
type NFSEventsStats struct {
|
|
93 |
// Number of times cached inode attributes are re-validated from the server.
|
|
94 |
InodeRevalidate int
|
|
95 |
// Number of times cached dentry nodes are re-validated from the server.
|
|
96 |
DnodeRevalidate int
|
|
97 |
// Number of times an inode cache is cleared.
|
|
98 |
DataInvalidate int
|
|
99 |
// Number of times cached inode attributes are invalidated.
|
|
100 |
AttributeInvalidate int
|
|
101 |
// Number of times files or directories have been open()'d.
|
|
102 |
VFSOpen int
|
|
103 |
// Number of times a directory lookup has occurred.
|
|
104 |
VFSLookup int
|
|
105 |
// Number of times permissions have been checked.
|
|
106 |
VFSAccess int
|
|
107 |
// Number of updates (and potential writes) to pages.
|
|
108 |
VFSUpdatePage int
|
|
109 |
// Number of pages read directly via mmap()'d files.
|
|
110 |
VFSReadPage int
|
|
111 |
// Number of times a group of pages have been read.
|
|
112 |
VFSReadPages int
|
|
113 |
// Number of pages written directly via mmap()'d files.
|
|
114 |
VFSWritePage int
|
|
115 |
// Number of times a group of pages have been written.
|
|
116 |
VFSWritePages int
|
|
117 |
// Number of times directory entries have been read with getdents().
|
|
118 |
VFSGetdents int
|
|
119 |
// Number of times attributes have been set on inodes.
|
|
120 |
VFSSetattr int
|
|
121 |
// Number of pending writes that have been forcefully flushed to the server.
|
|
122 |
VFSFlush int
|
|
123 |
// Number of times fsync() has been called on directories and files.
|
|
124 |
VFSFsync int
|
|
125 |
// Number of times locking has been attemped on a file.
|
|
126 |
VFSLock int
|
|
127 |
// Number of times files have been closed and released.
|
|
128 |
VFSFileRelease int
|
|
129 |
// Unknown. Possibly unused.
|
|
130 |
CongestionWait int
|
|
131 |
// Number of times files have been truncated.
|
|
132 |
Truncation int
|
|
133 |
// Number of times a file has been grown due to writes beyond its existing end.
|
|
134 |
WriteExtension int
|
|
135 |
// Number of times a file was removed while still open by another process.
|
|
136 |
SillyRename int
|
|
137 |
// Number of times the NFS server gave less data than expected while reading.
|
|
138 |
ShortRead int
|
|
139 |
// Number of times the NFS server wrote less data than expected while writing.
|
|
140 |
ShortWrite int
|
|
141 |
// Number of times the NFS server indicated EJUKEBOX; retrieving data from
|
|
142 |
// offline storage.
|
|
143 |
JukeboxDelay int
|
|
144 |
// Number of NFS v4.1+ pNFS reads.
|
|
145 |
PNFSRead int
|
|
146 |
// Number of NFS v4.1+ pNFS writes.
|
|
147 |
PNFSWrite int
|
|
148 |
}
|
|
149 |
|
|
150 |
// A NFSOperationStats contains statistics for a single operation.
|
|
151 |
type NFSOperationStats struct {
|
|
152 |
// The name of the operation.
|
|
153 |
Operation string
|
|
154 |
// Number of requests performed for this operation.
|
|
155 |
Requests int
|
|
156 |
// Number of times an actual RPC request has been transmitted for this operation.
|
|
157 |
Transmissions int
|
|
158 |
// Number of times a request has had a major timeout.
|
|
159 |
MajorTimeouts int
|
|
160 |
// Number of bytes sent for this operation, including RPC headers and payload.
|
|
161 |
BytesSent int
|
|
162 |
// Number of bytes received for this operation, including RPC headers and payload.
|
|
163 |
BytesReceived int
|
|
164 |
// Duration all requests spent queued for transmission before they were sent.
|
|
165 |
CumulativeQueueTime time.Duration
|
|
166 |
// Duration it took to get a reply back after the request was transmitted.
|
|
167 |
CumulativeTotalResponseTime time.Duration
|
|
168 |
// Duration from when a request was enqueued to when it was completely handled.
|
|
169 |
CumulativeTotalRequestTime time.Duration
|
|
170 |
}
|
|
171 |
|
|
172 |
// A NFSTransportStats contains statistics for the NFS mount RPC requests and
|
|
173 |
// responses.
|
|
174 |
type NFSTransportStats struct {
|
|
175 |
// The local port used for the NFS mount.
|
|
176 |
Port int
|
|
177 |
// Number of times the client has had to establish a connection from scratch
|
|
178 |
// to the NFS server.
|
|
179 |
Bind int
|
|
180 |
// Number of times the client has made a TCP connection to the NFS server.
|
|
181 |
Connect int
|
|
182 |
// Duration (in jiffies, a kernel internal unit of time) the NFS mount has
|
|
183 |
// spent waiting for connections to the server to be established.
|
|
184 |
ConnectIdleTime int
|
|
185 |
// Duration since the NFS mount last saw any RPC traffic.
|
|
186 |
IdleTime time.Duration
|
|
187 |
// Number of RPC requests for this mount sent to the NFS server.
|
|
188 |
Sends int
|
|
189 |
// Number of RPC responses for this mount received from the NFS server.
|
|
190 |
Receives int
|
|
191 |
// Number of times the NFS server sent a response with a transaction ID
|
|
192 |
// unknown to this client.
|
|
193 |
BadTransactionIDs int
|
|
194 |
// A running counter, incremented on each request as the current difference
|
|
195 |
// ebetween sends and receives.
|
|
196 |
CumulativeActiveRequests int
|
|
197 |
// A running counter, incremented on each request by the current backlog
|
|
198 |
// queue size.
|
|
199 |
CumulativeBacklog int
|
|
200 |
|
|
201 |
// Stats below only available with stat version 1.1.
|
|
202 |
|
|
203 |
// Maximum number of simultaneously active RPC requests ever used.
|
|
204 |
MaximumRPCSlotsUsed int
|
|
205 |
// A running counter, incremented on each request as the current size of the
|
|
206 |
// sending queue.
|
|
207 |
CumulativeSendingQueue int
|
|
208 |
// A running counter, incremented on each request as the current size of the
|
|
209 |
// pending queue.
|
|
210 |
CumulativePendingQueue int
|
|
211 |
}
|
|
212 |
|
|
213 |
// parseMountStats parses a /proc/[pid]/mountstats file and returns a slice
|
|
214 |
// of Mount structures containing detailed information about each mount.
|
|
215 |
// If available, statistics for each mount are parsed as well.
|
|
216 |
func parseMountStats(r io.Reader) ([]*Mount, error) {
|
|
217 |
const (
|
|
218 |
device = "device"
|
|
219 |
statVersionPrefix = "statvers="
|
|
220 |
|
|
221 |
nfs3Type = "nfs"
|
|
222 |
nfs4Type = "nfs4"
|
|
223 |
)
|
|
224 |
|
|
225 |
var mounts []*Mount
|
|
226 |
|
|
227 |
s := bufio.NewScanner(r)
|
|
228 |
for s.Scan() {
|
|
229 |
// Only look for device entries in this function
|
|
230 |
ss := strings.Fields(string(s.Bytes()))
|
|
231 |
if len(ss) == 0 || ss[0] != device {
|
|
232 |
continue
|
|
233 |
}
|
|
234 |
|
|
235 |
m, err := parseMount(ss)
|
|
236 |
if err != nil {
|
|
237 |
return nil, err
|
|
238 |
}
|
|
239 |
|
|
240 |
// Does this mount also possess statistics information?
|
|
241 |
if len(ss) > deviceEntryLen {
|
|
242 |
// Only NFSv3 and v4 are supported for parsing statistics
|
|
243 |
if m.Type != nfs3Type && m.Type != nfs4Type {
|
|
244 |
return nil, fmt.Errorf("cannot parse MountStats for fstype %q", m.Type)
|
|
245 |
}
|
|
246 |
|
|
247 |
statVersion := strings.TrimPrefix(ss[8], statVersionPrefix)
|
|
248 |
|
|
249 |
stats, err := parseMountStatsNFS(s, statVersion)
|
|
250 |
if err != nil {
|
|
251 |
return nil, err
|
|
252 |
}
|
|
253 |
|
|
254 |
m.Stats = stats
|
|
255 |
}
|
|
256 |
|
|
257 |
mounts = append(mounts, m)
|
|
258 |
}
|
|
259 |
|
|
260 |
return mounts, s.Err()
|
|
261 |
}
|
|
262 |
|
|
263 |
// parseMount parses an entry in /proc/[pid]/mountstats in the format:
|
|
264 |
// device [device] mounted on [mount] with fstype [type]
|
|
265 |
func parseMount(ss []string) (*Mount, error) {
|
|
266 |
if len(ss) < deviceEntryLen {
|
|
267 |
return nil, fmt.Errorf("invalid device entry: %v", ss)
|
|
268 |
}
|
|
269 |
|
|
270 |
// Check for specific words appearing at specific indices to ensure
|
|
271 |
// the format is consistent with what we expect
|
|
272 |
format := []struct {
|
|
273 |
i int
|
|
274 |
s string
|
|
275 |
}{
|
|
276 |
{i: 0, s: "device"},
|
|
277 |
{i: 2, s: "mounted"},
|
|
278 |
{i: 3, s: "on"},
|
|
279 |
{i: 5, s: "with"},
|
|
280 |
{i: 6, s: "fstype"},
|
|
281 |
}
|
|
282 |
|
|
283 |
for _, f := range format {
|
|
284 |
if ss[f.i] != f.s {
|
|
285 |
return nil, fmt.Errorf("invalid device entry: %v", ss)
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
return &Mount{
|
|
290 |
Device: ss[1],
|
|
291 |
Mount: ss[4],
|
|
292 |
Type: ss[7],
|
|
293 |
}, nil
|
|
294 |
}
|
|
295 |
|
|
296 |
// parseMountStatsNFS parses a MountStatsNFS by scanning additional information
|
|
297 |
// related to NFS statistics.
|
|
298 |
func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) {
|
|
299 |
// Field indicators for parsing specific types of data
|
|
300 |
const (
|
|
301 |
fieldAge = "age:"
|
|
302 |
fieldBytes = "bytes:"
|
|
303 |
fieldEvents = "events:"
|
|
304 |
fieldPerOpStats = "per-op"
|
|
305 |
fieldTransport = "xprt:"
|
|
306 |
)
|
|
307 |
|
|
308 |
stats := &MountStatsNFS{
|
|
309 |
StatVersion: statVersion,
|
|
310 |
}
|
|
311 |
|
|
312 |
for s.Scan() {
|
|
313 |
ss := strings.Fields(string(s.Bytes()))
|
|
314 |
if len(ss) == 0 {
|
|
315 |
break
|
|
316 |
}
|
|
317 |
if len(ss) < 2 {
|
|
318 |
return nil, fmt.Errorf("not enough information for NFS stats: %v", ss)
|
|
319 |
}
|
|
320 |
|
|
321 |
switch ss[0] {
|
|
322 |
case fieldAge:
|
|
323 |
// Age integer is in seconds
|
|
324 |
d, err := time.ParseDuration(ss[1] + "s")
|
|
325 |
if err != nil {
|
|
326 |
return nil, err
|
|
327 |
}
|
|
328 |
|
|
329 |
stats.Age = d
|
|
330 |
case fieldBytes:
|
|
331 |
bstats, err := parseNFSBytesStats(ss[1:])
|
|
332 |
if err != nil {
|
|
333 |
return nil, err
|
|
334 |
}
|
|
335 |
|
|
336 |
stats.Bytes = *bstats
|
|
337 |
case fieldEvents:
|
|
338 |
estats, err := parseNFSEventsStats(ss[1:])
|
|
339 |
if err != nil {
|
|
340 |
return nil, err
|
|
341 |
}
|
|
342 |
|
|
343 |
stats.Events = *estats
|
|
344 |
case fieldTransport:
|
|
345 |
if len(ss) < 3 {
|
|
346 |
return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss)
|
|
347 |
}
|
|
348 |
|
|
349 |
tstats, err := parseNFSTransportStats(ss[2:], statVersion)
|
|
350 |
if err != nil {
|
|
351 |
return nil, err
|
|
352 |
}
|
|
353 |
|
|
354 |
stats.Transport = *tstats
|
|
355 |
}
|
|
356 |
|
|
357 |
// When encountering "per-operation statistics", we must break this
|
|
358 |
// loop and parse them seperately to ensure we can terminate parsing
|
|
359 |
// before reaching another device entry; hence why this 'if' statement
|
|
360 |
// is not just another switch case
|
|
361 |
if ss[0] == fieldPerOpStats {
|
|
362 |
break
|
|
363 |
}
|
|
364 |
}
|
|
365 |
|
|
366 |
if err := s.Err(); err != nil {
|
|
367 |
return nil, err
|
|
368 |
}
|
|
369 |
|
|
370 |
// NFS per-operation stats appear last before the next device entry
|
|
371 |
perOpStats, err := parseNFSOperationStats(s)
|
|
372 |
if err != nil {
|
|
373 |
return nil, err
|
|
374 |
}
|
|
375 |
|
|
376 |
stats.Operations = perOpStats
|
|
377 |
|
|
378 |
return stats, nil
|
|
379 |
}
|
|
380 |
|
|
381 |
// parseNFSBytesStats parses a NFSBytesStats line using an input set of
|
|
382 |
// integer fields.
|
|
383 |
func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) {
|
|
384 |
if len(ss) != fieldBytesLen {
|
|
385 |
return nil, fmt.Errorf("invalid NFS bytes stats: %v", ss)
|
|
386 |
}
|
|
387 |
|
|
388 |
ns := make([]int, 0, fieldBytesLen)
|
|
389 |
for _, s := range ss {
|
|
390 |
n, err := strconv.Atoi(s)
|
|
391 |
if err != nil {
|
|
392 |
return nil, err
|
|
393 |
}
|
|
394 |
|
|
395 |
ns = append(ns, n)
|
|
396 |
}
|
|
397 |
|
|
398 |
return &NFSBytesStats{
|
|
399 |
Read: ns[0],
|
|
400 |
Write: ns[1],
|
|
401 |
DirectRead: ns[2],
|
|
402 |
DirectWrite: ns[3],
|
|
403 |
ReadTotal: ns[4],
|
|
404 |
WriteTotal: ns[5],
|
|
405 |
ReadPages: ns[6],
|
|
406 |
WritePages: ns[7],
|
|
407 |
}, nil
|
|
408 |
}
|
|
409 |
|
|
410 |
// parseNFSEventsStats parses a NFSEventsStats line using an input set of
|
|
411 |
// integer fields.
|
|
412 |
func parseNFSEventsStats(ss []string) (*NFSEventsStats, error) {
|
|
413 |
if len(ss) != fieldEventsLen {
|
|
414 |
return nil, fmt.Errorf("invalid NFS events stats: %v", ss)
|
|
415 |
}
|
|
416 |
|
|
417 |
ns := make([]int, 0, fieldEventsLen)
|
|
418 |
for _, s := range ss {
|
|
419 |
n, err := strconv.Atoi(s)
|
|
420 |
if err != nil {
|
|
421 |
return nil, err
|
|
422 |
}
|
|
423 |
|
|
424 |
ns = append(ns, n)
|
|
425 |
}
|
|
426 |
|
|
427 |
return &NFSEventsStats{
|
|
428 |
InodeRevalidate: ns[0],
|
|
429 |
DnodeRevalidate: ns[1],
|
|
430 |
DataInvalidate: ns[2],
|
|
431 |
AttributeInvalidate: ns[3],
|
|
432 |
VFSOpen: ns[4],
|
|
433 |
VFSLookup: ns[5],
|
|
434 |
VFSAccess: ns[6],
|
|
435 |
VFSUpdatePage: ns[7],
|
|
436 |
VFSReadPage: ns[8],
|
|
437 |
VFSReadPages: ns[9],
|
|
438 |
VFSWritePage: ns[10],
|
|
439 |
VFSWritePages: ns[11],
|
|
440 |
VFSGetdents: ns[12],
|
|
441 |
VFSSetattr: ns[13],
|
|
442 |
VFSFlush: ns[14],
|
|
443 |
VFSFsync: ns[15],
|
|
444 |
VFSLock: ns[16],
|
|
445 |
VFSFileRelease: ns[17],
|
|
446 |
CongestionWait: ns[18],
|
|
447 |
Truncation: ns[19],
|
|
448 |
WriteExtension: ns[20],
|
|
449 |
SillyRename: ns[21],
|
|
450 |
ShortRead: ns[22],
|
|
451 |
ShortWrite: ns[23],
|
|
452 |
JukeboxDelay: ns[24],
|
|
453 |
PNFSRead: ns[25],
|
|
454 |
PNFSWrite: ns[26],
|
|
455 |
}, nil
|
|
456 |
}
|
|
457 |
|
|
458 |
// parseNFSOperationStats parses a slice of NFSOperationStats by scanning
|
|
459 |
// additional information about per-operation statistics until an empty
|
|
460 |
// line is reached.
|
|
461 |
func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) {
|
|
462 |
const (
|
|
463 |
// Number of expected fields in each per-operation statistics set
|
|
464 |
numFields = 9
|
|
465 |
)
|
|
466 |
|
|
467 |
var ops []NFSOperationStats
|
|
468 |
|
|
469 |
for s.Scan() {
|
|
470 |
ss := strings.Fields(string(s.Bytes()))
|
|
471 |
if len(ss) == 0 {
|
|
472 |
// Must break when reading a blank line after per-operation stats to
|
|
473 |
// enable top-level function to parse the next device entry
|
|
474 |
break
|
|
475 |
}
|
|
476 |
|
|
477 |
if len(ss) != numFields {
|
|
478 |
return nil, fmt.Errorf("invalid NFS per-operations stats: %v", ss)
|
|
479 |
}
|
|
480 |
|
|
481 |
// Skip string operation name for integers
|
|
482 |
ns := make([]int, 0, numFields-1)
|
|
483 |
for _, st := range ss[1:] {
|
|
484 |
n, err := strconv.Atoi(st)
|
|
485 |
if err != nil {
|
|
486 |
return nil, err
|
|
487 |
}
|
|
488 |
|
|
489 |
ns = append(ns, n)
|
|
490 |
}
|
|
491 |
|
|
492 |
ops = append(ops, NFSOperationStats{
|
|
493 |
Operation: strings.TrimSuffix(ss[0], ":"),
|
|
494 |
Requests: ns[0],
|
|
495 |
Transmissions: ns[1],
|
|
496 |
MajorTimeouts: ns[2],
|
|
497 |
BytesSent: ns[3],
|
|
498 |
BytesReceived: ns[4],
|
|
499 |
CumulativeQueueTime: time.Duration(ns[5]) * time.Millisecond,
|
|
500 |
CumulativeTotalResponseTime: time.Duration(ns[6]) * time.Millisecond,
|
|
501 |
CumulativeTotalRequestTime: time.Duration(ns[7]) * time.Millisecond,
|
|
502 |
})
|
|
503 |
}
|
|
504 |
|
|
505 |
return ops, s.Err()
|
|
506 |
}
|
|
507 |
|
|
508 |
// parseNFSTransportStats parses a NFSTransportStats line using an input set of
|
|
509 |
// integer fields matched to a specific stats version.
|
|
510 |
func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) {
|
|
511 |
switch statVersion {
|
|
512 |
case statVersion10:
|
|
513 |
if len(ss) != fieldTransport10Len {
|
|
514 |
return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss)
|
|
515 |
}
|
|
516 |
case statVersion11:
|
|
517 |
if len(ss) != fieldTransport11Len {
|
|
518 |
return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss)
|
|
519 |
}
|
|
520 |
default:
|
|
521 |
return nil, fmt.Errorf("unrecognized NFS transport stats version: %q", statVersion)
|
|
522 |
}
|
|
523 |
|
|
524 |
// Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay
|
|
525 |
// in a v1.0 response
|
|
526 |
ns := make([]int, 0, fieldTransport11Len)
|
|
527 |
for _, s := range ss {
|
|
528 |
n, err := strconv.Atoi(s)
|
|
529 |
if err != nil {
|
|
530 |
return nil, err
|
|
531 |
}
|
|
532 |
|
|
533 |
ns = append(ns, n)
|
|
534 |
}
|
|
535 |
|
|
536 |
return &NFSTransportStats{
|
|
537 |
Port: ns[0],
|
|
538 |
Bind: ns[1],
|
|
539 |
Connect: ns[2],
|
|
540 |
ConnectIdleTime: ns[3],
|
|
541 |
IdleTime: time.Duration(ns[4]) * time.Second,
|
|
542 |
Sends: ns[5],
|
|
543 |
Receives: ns[6],
|
|
544 |
BadTransactionIDs: ns[7],
|
|
545 |
CumulativeActiveRequests: ns[8],
|
|
546 |
CumulativeBacklog: ns[9],
|
|
547 |
MaximumRPCSlotsUsed: ns[10],
|
|
548 |
CumulativeSendingQueue: ns[11],
|
|
549 |
CumulativePendingQueue: ns[12],
|
|
550 |
}, nil
|
|
551 |
}
|