forget to implements String()

This commit is contained in:
Shirou WAKAYAMA 2014-05-01 18:53:07 +09:00
parent 8098298111
commit b6b79b5b38
2 changed files with 14 additions and 2 deletions

4
net.go
View File

@ -31,12 +31,12 @@ type NetConnectionStat struct {
Pid int32 `json:"pid"`
}
func (n NetConnectionStat) String() string {
func (n NetIOCountersStat) String() string {
s, _ := json.Marshal(n)
return string(s)
}
func (n NetIOCountersStat) String() string {
func (n NetConnectionStat) String() string {
s, _ := json.Marshal(n)
return string(s)
}

View File

@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"syscall"
"encoding/json"
)
const (
@ -26,6 +27,10 @@ type MemoryInfoExStat struct {
Data uint64 `json:"data"` // bytes
Dirty uint64 `json:"dirty"` // bytes
}
func (m MemoryInfoExStat) String() string {
s, _ := json.Marshal(m)
return string(s)
}
type MemoryMapsStat struct {
Path string `json:"path"`
@ -41,6 +46,13 @@ type MemoryMapsStat struct {
Swap uint64 `json:"swap"`
}
func (m MemoryMapsStat) String() string {
s, _ := json.Marshal(m)
return string(s)
}
// Create new Process instance
// This only stores Pid
func NewProcess(pid int32) (*Process, error) {