提交 a768e841 作者: Jeromy 提交者: Juan Batiz-Benet

update printout for net diag

上级 6cb46a70
...@@ -14,6 +14,7 @@ type DiagnosticConnection struct { ...@@ -14,6 +14,7 @@ type DiagnosticConnection struct {
ID string ID string
// TODO use milliseconds or microseconds for human readability // TODO use milliseconds or microseconds for human readability
NanosecondsLatency uint64 NanosecondsLatency uint64
Count int
} }
type DiagnosticPeer struct { type DiagnosticPeer struct {
...@@ -70,6 +71,7 @@ connected peers and latencies between them. ...@@ -70,6 +71,7 @@ connected peers and latencies between them.
connections[j] = DiagnosticConnection{ connections[j] = DiagnosticConnection{
ID: conn.ID, ID: conn.ID,
NanosecondsLatency: uint64(conn.Latency.Nanoseconds()), NanosecondsLatency: uint64(conn.Latency.Nanoseconds()),
Count: conn.Count,
} }
} }
...@@ -102,16 +104,10 @@ connected peers and latencies between them. ...@@ -102,16 +104,10 @@ connected peers and latencies between them.
} }
func printDiagnostics(out io.Writer, info *DiagnosticOutput) error { func printDiagnostics(out io.Writer, info *DiagnosticOutput) error {
diagTmpl := ` diagTmpl := `
{{ range $peer := .Peers }} {{ range $peer := .Peers }}
ID {{ $peer.ID }} ID {{ $peer.ID }} up {{ $peer.UptimeSeconds }} seconds connected to {{ len .Connections }}:{{ range $connection := .Connections }}
up {{ $peer.UptimeSeconds }} seconds ID {{ $connection.ID }} connections: {{ $connection.Count }} latency: {{ $connection.NanosecondsLatency }} ns{{ end }}
connected to {{ len .Connections }}...
{{ range $connection := .Connections }}
ID {{ $connection.ID }}
latency: {{ $connection.NanosecondsLatency }} ns
{{ end }}
{{end}} {{end}}
` `
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论