/
processinfo.go
37 lines (29 loc) · 1001 Bytes
/
processinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2020 Condensat Tech. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package model
import (
"time"
"github.com/condensat/bank-core/messaging"
)
type ProcessInfo struct {
ID uint64 `gorm:"primary_key"`
Timestamp time.Time `gorm:"index;not null"`
AppName string `gorm:"index;not null"`
Hostname string `gorm:"index;not null"`
PID int `gorm:"not null"`
MemAlloc uint64 `gorm:"not null"`
MemTotalAlloc uint64 `gorm:"not null"`
MemSys uint64 `gorm:"not null"`
MemLookups uint64 `gorm:"not null"`
NumCPU uint64 `gorm:"not null"`
NumGoroutine uint64 `gorm:"not null"`
NumCgoCall uint64 `gorm:"not null"`
CPUUsage float64 `gorm:"not null"`
}
func (p *ProcessInfo) Encode() ([]byte, error) {
return messaging.EncodeObject(p)
}
func (p *ProcessInfo) Decode(data []byte) error {
return messaging.DecodeObject(data, messaging.BankObject(p))
}