stat

package
v1.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 15

Documentation

Index

Constants

View Source
const (
	DefaultMaxOps   = 100
	DefaultDuration = time.Minute
)
View Source
const (
	Stat_Module        = "mem_stat"
	FileNameDateFormat = "20060102150405"
	ShiftedExtension   = ".old"
	PRO_MEM            = "/proc/%d/status"

	F_OK               = 0
	MaxTimeoutLevel    = 3
	DefaultStatLogSize = 200 * 1024 * 1024 // 200M
	DefaultHeadRoom    = 50 * 1024         // 50G
	MaxReservedDays    = 7 * 24 * time.Hour
)

Variables

View Source
var (
	DpStat   = new(OpLogger)
	DiskStat = new(OpLogger)
)
View Source
var DefaultStatInterval = 60 * time.Second // 60 seconds
View Source
var DefaultTimeOutUs = [MaxTimeoutLevel]uint32{100000, 500000, 1000000}

Functions

func BeginStat

func BeginStat() (bgTime *time.Time)

func ClearStat

func ClearStat()

func CloseStat

func CloseStat()

func EndStat

func EndStat(typeName string, err error, bgTime *time.Time, statCount uint32) error

func GetMememory

func GetMememory() (Virt, Res uint64, err error)

func GetProcessMemory

func GetProcessMemory(pid int) (Virt, Res uint64, err error)

func RecordStat

func RecordStat(partitionID uint64, op string, dataPath string)

func StatBandWidth

func StatBandWidth(typeName string, Size uint32)

func WriteStat

func WriteStat() error

Types

type OpLogger

type OpLogger struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewOpLogger

func NewOpLogger(dir, filename string, maxOps int, duration time.Duration, leftSpaceRatio float64) (*OpLogger, error)

func (*OpLogger) Close

func (l *OpLogger) Close()

func (*OpLogger) GetMasterOps

func (l *OpLogger) GetMasterOps() []*Operation

func (*OpLogger) GetPrevOps

func (l *OpLogger) GetPrevOps() []*Operation

func (*OpLogger) IsRecordFile

func (l *OpLogger) IsRecordFile() bool

func (*OpLogger) IsSendMaster

func (l *OpLogger) IsSendMaster() bool

func (*OpLogger) Record

func (l *OpLogger) Record(name string)

func (*OpLogger) RecordOp

func (l *OpLogger) RecordOp(name, op string)

func (*OpLogger) SetArgs

func (l *OpLogger) SetArgs(reserveTime time.Duration, fileSize int64)

used for test

func (*OpLogger) SetFileSize

func (l *OpLogger) SetFileSize(fileSize int64)

func (*OpLogger) SetRecordFile

func (l *OpLogger) SetRecordFile(recordFile bool)

func (*OpLogger) SetSendMaster

func (l *OpLogger) SetSendMaster(sendMaster bool)

type Operation

type Operation struct {
	Name  string
	Op    string
	Count int32
}

type ShiftedFile

type ShiftedFile []os.FileInfo

func (ShiftedFile) Len

func (f ShiftedFile) Len() int

func (ShiftedFile) Less

func (f ShiftedFile) Less(i, j int) bool

func (ShiftedFile) Swap

func (f ShiftedFile) Swap(i, j int)

type Statistic

type Statistic struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStatistic

func NewStatistic(dir, logModule string, logMaxSize int64, timeOutUs [MaxTimeoutLevel]uint32, useMutex bool) (*Statistic, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL