예제 #1
0
// Show connection metrics.
func ShowStats(exampid, tag string, conn *stompngo.Connection) {
	r := conn.FramesRead()
	br := conn.BytesRead()
	w := conn.FramesWritten()
	bw := conn.BytesWritten()
	s := conn.Running().Seconds()
	n := conn.Running().Nanoseconds()
	llu.Printf("%stag:%s frame_read_count:%v\n", exampid, tag, r)
	llu.Printf("%stag:%s bytes_read:%v\n", exampid, tag, br)
	llu.Printf("%stag:%s frame_write_count:%v\n", exampid, tag, w)
	llu.Printf("%stag:%s bytes_written:%v\n", exampid, tag, bw)
	llu.Printf("%stag:%s current_duration(ns):%v\n", exampid, tag, n)

	llu.Printf("%stag:%s current_duration(sec):%20.6f\n", exampid, tag, s)
	llu.Printf("%stag:%s frame_reads/sec:%20.6f\n", exampid, tag, float64(r)/s)
	llu.Printf("%stag:%s bytes_read/sec:%20.6f\n", exampid, tag, float64(br)/s)
	llu.Printf("%stag:%s frame_writes/sec:%20.6f\n", exampid, tag, float64(w)/s)
	llu.Printf("%stag:%s bytes_written/sec:%20.6f\n", exampid, tag, float64(bw)/s)
}