Skip to content

Commit fafa4f7

Browse files
committed
netstack: fmt endpoint stats
1 parent f07514c commit fafa4f7

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

intra/netstack/fdbased.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ func (e *endpoint) Cur() int {
250250
func (e *endpoint) Stat() string {
251251
fds := e.fds.Load()
252252
if fds == nil {
253-
// fd, age, read, written, lastRead, lastWrite
254-
return "-1,0,0,0,0,0"
253+
return "<nil>"
255254
}
256255

257256
t := time.Now()
@@ -261,11 +260,11 @@ func (e *endpoint) Stat() string {
261260

262261
age := t.Sub(time.UnixMilli(fds.since.Load()))
263262

264-
return fmt.Sprintf("%d,%s,%d,%d,%s,%s",
263+
return fmt.Sprintf("Fd: %d, Age: %s, R: %s, W: %s, LastRead: %s, LastWrite%s",
265264
fds.tunFd, // f.tun() returns invalidfd if f.tunFd is closed
266265
core.FmtPeriod(age),
267-
fds.read.Load(),
268-
fds.written.Load(),
266+
core.FmtBytes(uint64(fds.read.Load())),
267+
core.FmtBytes(uint64(fds.written.Load())),
269268
core.FmtUnixMillisAsPeriod(fds.lastRead.Load()),
270269
core.FmtUnixMillisAsPeriod(fds.lastWrite.Load()))
271270
}

0 commit comments

Comments
 (0)