mirror of https://github.com/ledisdb/ledisdb.git
remove cpu info
1, cpu info field is not cross platform 2, may use other tool to see
This commit is contained in:
parent
53ff437877
commit
947ec0081b
|
@ -9,7 +9,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type info struct {
|
type info struct {
|
||||||
|
@ -76,8 +75,6 @@ func (i *info) Dump(section string) []byte {
|
||||||
i.dumpServer(buf)
|
i.dumpServer(buf)
|
||||||
case "client":
|
case "client":
|
||||||
i.dumpClients(buf)
|
i.dumpClients(buf)
|
||||||
case "cpu":
|
|
||||||
i.dumpCPU(buf)
|
|
||||||
case "mem":
|
case "mem":
|
||||||
i.dumpMem(buf)
|
i.dumpMem(buf)
|
||||||
case "persistence":
|
case "persistence":
|
||||||
|
@ -103,8 +100,6 @@ func (i *info) dumpAll(buf *bytes.Buffer) {
|
||||||
buf.Write(Delims)
|
buf.Write(Delims)
|
||||||
i.dumpClients(buf)
|
i.dumpClients(buf)
|
||||||
buf.Write(Delims)
|
buf.Write(Delims)
|
||||||
i.dumpCPU(buf)
|
|
||||||
buf.Write(Delims)
|
|
||||||
i.dumpMem(buf)
|
i.dumpMem(buf)
|
||||||
buf.Write(Delims)
|
buf.Write(Delims)
|
||||||
i.dumpGoroutine(buf)
|
i.dumpGoroutine(buf)
|
||||||
|
@ -125,18 +120,6 @@ func (i *info) dumpClients(buf *bytes.Buffer) {
|
||||||
i.dumpPairs(buf, infoPair{"client_num", i.Clients.ConnectedClients})
|
i.dumpPairs(buf, infoPair{"client_num", i.Clients.ConnectedClients})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *info) dumpCPU(buf *bytes.Buffer) {
|
|
||||||
buf.WriteString("# CPU\r\n")
|
|
||||||
|
|
||||||
var rusage syscall.Rusage
|
|
||||||
if err := syscall.Getrusage(syscall.RUSAGE_SELF, &rusage); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
i.dumpPairs(buf, infoPair{"cpu_sys", rusage.Stime.Usec},
|
|
||||||
infoPair{"cpu_user", rusage.Utime.Usec})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *info) dumpMem(buf *bytes.Buffer) {
|
func (i *info) dumpMem(buf *bytes.Buffer) {
|
||||||
buf.WriteString("# Mem\r\n")
|
buf.WriteString("# Mem\r\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue