statistics

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStatGridNum = int64(5)
)
View Source
const (
	DelayInterval = time.Second * 5
)
View Source
const StatInterval = 3 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type AVFlow

type AVFlow struct {
	VideoBitrate  *Bitrate
	AudioBitrate  *Bitrate
	VideoFPS      *FPS
	AudioFPS      *FPS
	VideoGop      *Gop
	VideoDelay    *Delay
	VideoDuration *Duration
	AudioDuration *Duration
}

AVFlow 流统计

func NewAVFlow

func NewAVFlow() *AVFlow

NewAVFlow 创建AVFlow实例

func (*AVFlow) Stat

func (s *AVFlow) Stat(pkt *av.Packet)

Stat 统计av.Packet的音视频数据

type Bitrate

type Bitrate struct {
	// contains filtered or unexported fields
}

Bitrate 码率统计对象

func NewBitrate

func NewBitrate() *Bitrate

NewBitrate ...

func (*Bitrate) Add

func (b *Bitrate) Add(size uint64)

Add ...

func (*Bitrate) GetBitTotal

func (b *Bitrate) GetBitTotal() uint64

GetBitTotal ...

func (*Bitrate) GetBitrate

func (b *Bitrate) GetBitrate() uint64

GetBitrate ...

func (*Bitrate) String

func (b *Bitrate) String() string

type Delay

type Delay struct {
	// contains filtered or unexported fields
}

func NewDelay

func NewDelay() *Delay

func (*Delay) Add

func (d *Delay) Add(pktTS int64)

func (*Delay) GetDelay

func (d *Delay) GetDelay() int64

return ms

func (*Delay) String

func (d *Delay) String() string

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

func NewDuration

func NewDuration() *Duration

func (*Duration) Add

func (d *Duration) Add(pktTS int64)

func (*Duration) GetDuration

func (d *Duration) GetDuration() int64

GetDuration only call by stat once every period

type FPS

type FPS struct {
	// contains filtered or unexported fields
}

FPS 帧率统计

func NewFPS

func NewFPS() *FPS

NewFPS 创建FPS实例

func (*FPS) Add

func (f *FPS) Add()

Add ...

func (*FPS) GetFPS

func (f *FPS) GetFPS() uint32

GetFPS ...

func (*FPS) String

func (f *FPS) String() string

type Gop

type Gop struct {
	// contains filtered or unexported fields
}

Gop gop统计

func NewGop

func NewGop() *Gop

NewGop ...

func (*Gop) Add

func (g *Gop) Add(pkt *av.Packet)

Add ...

func (*Gop) GetGop

func (g *Gop) GetGop() float64

GetGop ...

func (*Gop) String

func (g *Gop) String() string

type PeriodicStatistic

type PeriodicStatistic struct {
	// contains filtered or unexported fields
}

PeriodicStatistic 周期统计工具,滚动统计周期内数据的最大、最小、平均值

func NewPeriodicStatistic

func NewPeriodicStatistic(gridNum, gridPeriod int64) *PeriodicStatistic

NewPeriodicStatistic 创建周期统计对象, gridNum统计格子数量, gridPeriod格子时间长度,单位秒

func (*PeriodicStatistic) Avg

func (rcv *PeriodicStatistic) Avg() int64

Avg 统计平均值

func (*PeriodicStatistic) Max

func (rcv *PeriodicStatistic) Max() int64

Max 统计最大值

func (*PeriodicStatistic) Min

func (rcv *PeriodicStatistic) Min() int64

Min 统计最小值

func (*PeriodicStatistic) Stat

func (rcv *PeriodicStatistic) Stat(val int64)

Stat 添加统计值

func (*PeriodicStatistic) Sum

func (rcv *PeriodicStatistic) Sum() int64

Sum 统计总数

type ProcStat

type ProcStat struct {
	// The process ID.
	PID int
	// The filename of the executable.
	Comm string
	// The process state.
	State string
	// The PID of the parent of this process.
	PPID int
	// The process group ID of the process.
	PGRP int
	// The session ID of the process.
	Session int
	// The controlling terminal of the process.
	TTY int
	// The ID of the foreground process group of the controlling terminal of
	// the process.
	TPGID int
	// The kernel flags word of the process.
	Flags uint
	// The number of minor faults the process has made which have not required
	// loading a memory page from disk.
	MinFlt uint
	// The number of minor faults that the process's waited-for children have
	// made.
	CMinFlt uint
	// The number of major faults the process has made which have required
	// loading a memory page from disk.
	MajFlt uint
	// The number of major faults that the process's waited-for children have
	// made.
	CMajFlt uint
	// Amount of time that this process has been scheduled in user mode,
	// measured in clock ticks.
	UTime uint
	// Amount of time that this process has been scheduled in kernel mode,
	// measured in clock ticks.
	STime uint
	// Amount of time that this process's waited-for children have been
	// scheduled in user mode, measured in clock ticks.
	CUTime uint
	// Amount of time that this process's waited-for children have been
	// scheduled in kernel mode, measured in clock ticks.
	CSTime uint
	// For processes running a real-time scheduling policy, this is the negated
	// scheduling priority, minus one.
	Priority int
	// The nice value, a value in the range 19 (low priority) to -20 (high
	// priority).
	Nice int
	// Number of threads in this process.
	NumThreads int
	// The time the process started after system boot, the value is expressed
	// in clock ticks.
	Starttime uint64
	// Virtual memory size in bytes.
	VSize uint64
	// Resident set size in pages.
	RSS uint64
}

ProcStat process stat from /proc/[pid]/stat

func CurrentProcStat

func CurrentProcStat() (ProcStat, error)

CurrentProcStat 当前进程的stat数据

func NewProcStat

func NewProcStat(statfile string, pid int) (ProcStat, error)

NewProcStat 生成一个进程的stat数据

func (ProcStat) ResidentMemory

func (s ProcStat) ResidentMemory() uint64

ResidentMemory returns the resident memory size in bytes.

func (ProcStat) VirtualMemory

func (s ProcStat) VirtualMemory() uint64

VirtualMemory returns the virtual memory size in bytes.

type Stream

type Stream struct {
	PlayerNum      int32
	QuicPlayerNum  int32
	HlsPlayerNum   int32
	SlicePlayerNum int32
	ForwarderNum   int32
	InBW           uint64
	OutBW          uint64
	HlsBw          uint64
	SliceInBW      uint64
	SliceOutBW     uint64
}

type StreamHandler

type StreamHandler struct {
	VideoBitrate  uint64
	VideoFPS      uint32
	AudioFPS      uint32
	VideoGop      float64
	VideoWidth    uint32
	VideoHeight   uint32
	VideoDuration int64
	AudioDuration int64
	AudioBitrate  uint64
	VideoDelay    int64
}

func (*StreamHandler) VideoDurationDelay

func (sh *StreamHandler) VideoDurationDelay() int64

VideoDurationDelay 视频时长与现实时间的diff,毫秒

Jump to

Keyboard shortcuts

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