psss

package
v0.0.0-...-4bf4393 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DT_UNKNOWN = 0
	DT_FIFO    = 1
	DT_CHR     = 2
	DT_DIR     = 4
	DT_BLK     = 6
	DT_REG     = 8
	DT_LNK     = 10
	DT_SOCK    = 12
	DT_WHT     = 14
)
View Source
const (
	SsUNKNOWN uint8 = iota
	SsESTAB
	SsSYNSENT
	SsSYNRECV
	SsFINWAIT1
	SsFINWAIT2
	SsTIMEWAIT
	SsUNCONN
	SsCLOSEWAIT
	SsLASTACK
	SsLISTEN
	SsCLOSING
	SsMAX
)
View Source
const (
	SOCK_STREAM    = 1
	SOCK_DGRAM     = 2
	SOCK_RAW       = 3
	SOCK_RDM       = 4
	SOCK_SEQPACKET = 5
	SOCK_DCCP      = 6
	SOCK_PACKET    = 10
)
View Source
const (
	SK_MEMINFO_RMEM_ALLOC = iota
	SK_MEMINFO_RCVBUF
	SK_MEMINFO_WMEM_ALLOC
	SK_MEMINFO_SNDBUF
	SK_MEMINFO_FWD_ALLOC
	SK_MEMINFO_WMEM_QUEUED
	SK_MEMINFO_OPTMEM
	SK_MEMINFO_BACKLOG
	SK_MEMINFO_DROPS
	SK_MEMINFO_VARS
)
View Source
const (
	IPv4String = "IPv4"
	IPv6String = "IPv6"
)
View Source
const (
	ProtocalUnknown = 1 << iota
	ProtocalDCCP
	ProtocalNetlink
	ProtocalPacket
	ProtocalRAW
	ProtocalSCTP
	ProtocalTCP
	ProtocalUDP
	ProtocalUnix
	ProtocalMax
)
View Source
const (
	SOCK_DIAG_BY_FAMILY = 20

	SizeOfUnixDiagRequest = 40
	SizeOfUnixDiagMsg     = 16
	SizeOfInetDiagRequest = 72
	SizeOfInetDiagMsg     = 72
)
View Source
const (
	INET_DIAG_NONE = iota
	INET_DIAG_MEMINFO
	INET_DIAG_INFO
	INET_DIAG_VEGASINFO
	INET_DIAG_CONG
	INET_DIAG_TOS
	INET_DIAG_TCLASS
	INET_DIAG_SKMEMINFO
	INET_DIAG_SHUTDOWN
	INET_DIAG_DCTCPINFO
	INET_DIAG_PROTOCOL /* response attribute only */
	INET_DIAG_SKV6ONLY
	INET_DIAG_LOCALS
	INET_DIAG_PEERS
	INET_DIAG_PAD
	INET_DIAG_MARK
	INET_DIAG_BBRINFO
	INET_DIAG_MAX
)
View Source
const (
	TCPI_OPT_TIMESTAMPS = 1
	TCPI_OPT_SACK       = 2
	TCPI_OPT_WSCALE     = 4
	TCPI_OPT_ECN        = 8  /* ECN was negociated at TCP session init */
	TCPI_OPT_ECN_SEEN   = 16 /* we received at least one packet with ECT */
	TCPI_OPT_SYN_DATA   = 32 /* SYN-ACK acked data in SYN sent or rcvd */
)
View Source
const (
	UDIAG_SHOW_NAME    = 0x00000001 /* show name (not path) */
	UDIAG_SHOW_VFS     = 0x00000002 /* show VFS inode info */
	UDIAG_SHOW_PEER    = 0x00000004 /* show peer socket info */
	UDIAG_SHOW_ICONS   = 0x00000008 /* show pending connections */
	UDIAG_SHOW_RQLEN   = 0x00000010 /* show skb receive queue len */
	UDIAG_SHOW_MEMINFO = 0x00000020 /* show memory info of a socket */
)
View Source
const (
	UNIX_DIAG_NAME = iota
	UNIX_DIAG_VFS
	UNIX_DIAG_PEER
	UNIX_DIAG_ICONS
	UNIX_DIAG_RQLEN
	UNIX_DIAG_MEMINFO
	UNIX_DIAG_SHUTDOWN
	UNIX_DIAG_MAX
)
View Source
const ProcRoot = "/proc"

Variables

View Source
var (
	AfFilter       uint64
	ProtocalFilter uint64
	SsFilter       uint32

	FlagProcess bool
	FlagInfo    bool
	FlagMemory  bool

	MaxLocalAddrLength  int
	MaxRemoteAddrLength int
)
View Source
var (
	OSPageSize = os.Getpagesize()

	SC_CLK_TCK = uint64(C.sysconf(C._SC_CLK_TCK))
)
View Source
var (
	// channel
	SocketInfoChan chan SocketInfo
	ProcInfoChan   chan *ProcInfo

	GlobalProcFds map[string]map[int]map[uint32]Fd
)
View Source
var (
	Sstate = []string{
		"UNKNOWN",
		"ESTAB",
		"SYN-SENT",
		"SYN-RECV",
		"FIN-WAIT-1",
		"FIN-WAIT-2",
		"TIME-WAIT",
		"UNCONN",
		"CLOSE-WAIT",
		"LAST-ACK",
		"LISTEN",
		"CLOSING",
		"MAX",
	}

	SocketType = map[uint8]string{
		SOCK_STREAM:    "str",
		SOCK_DGRAM:     "dgr",
		SOCK_RAW:       "raw",
		SOCK_RDM:       "rdm",
		SOCK_SEQPACKET: "seq",
		SOCK_DCCP:      "dccp",
		SOCK_PACKET:    "pack",
	}

	TimerState = []string{
		"OFF",
		"ON",
		"KEEPALIVE",
		"TIMEWAIT",
		"PERSIST",
		"UNKNOWN",
	}

	SummaryPF = []string{
		"TCP",
		"UDP",
		"UDPLITE",
		"RAW",
		"FRAG",
	}

	Colons = []string{
		":::::::",
		"::::::",
		":::::",
		"::::",
		":::",
	}
)
View Source
var (
	ErrorDone = fmt.Errorf("Done")
)
View Source
var ProcState = map[byte]string{
	'R': "Running",
	'S': "Sleeping",
	'D': "Waiting",
	'Z': "Zombie",
	'T': "Stopped",
	't': "Tracing",
	'X': "Dead",
	'x': "Dead",
	'K': "Wakekill",
	'W': "Waking",
	'P': "Parked",
}
View Source
var (
	SlimSpaceRegExp *regexp.Regexp
)
View Source
var (
	UnixSstate = []uint8{
		SsUNCONN,
		SsSYNSENT,
		SsESTAB,
		SsCLOSING,
	}
)

Functions

func AddrLengthInit

func AddrLengthInit()

func BwToStr

func BwToStr(bw float64) string

func CleanGlobalProcFds

func CleanGlobalProcFds()

func GenericInetRead

func GenericInetRead(protocal, af int) (sis map[uint32]SocketInfo, err error)

func GenericReadSockstat

func GenericReadSockstat() (summary map[string]map[string]int, err error)

IPv6:versionFlag = true; IPv4:versionFlag = false

func GenericUnixRead

func GenericUnixRead() (sis map[uint32]SocketInfo, err error)

func GetProcInfo

func GetProcInfo(nameSet map[string]bool, fdFlag bool) map[string]map[int]*ProcInfo

func GetSocketCount

func GetSocketCount(fields []string) (int, error)

func IPv4HexToString

func IPv4HexToString(ipHex string) (ip string, err error)

func IPv6HexToString

func IPv6HexToString(ipHex string) (ip string, err error)

func RecvInetDiagMsgAll

func RecvInetDiagMsgAll(skfd int)

func RecvInetDiagMsgMulti

func RecvInetDiagMsgMulti(skfd int) (err error)

func RecvUnixDiagMsgAll

func RecvUnixDiagMsgAll(skfd int)

func RecvUnixDiagMsgMulti

func RecvUnixDiagMsgMulti(skfd int) (err error)

func ScanProcFS

func ScanProcFS(fdFlag bool)

func SendInetDiagMsg

func SendInetDiagMsg(af uint8, protocal uint8, exts uint8, states uint32) (skfd int, err error)

func SendUnixDiagMsg

func SendUnixDiagMsg(states uint32, show uint32) (skfd int, err error)

Make sure the caller of the function will close skfd

Types

type CPUJiffies

type CPUJiffies struct {
	User      uint64 // Time spent in user mode.
	Nice      uint64 // Time spent in user mode with low priority (nice).
	System    uint64 // Time spent in system mode.
	Idle      uint64 // Time spent in the idle task. This value should be USER_HZ times the second entry in the /proc/uptime pseudo-file.
	Iowait    uint64 // Time waiting for I/O to complete.
	Irq       uint64 // Time servicing interrupts.
	Softirq   uint64 // Time servicing softirqs.
	Steal     uint64 // Stolen time, which is the time spent in other operating systems when running in a virtualized environment
	Guest     uint64 // Time spent running a virtual CPU for guest operating systems under the control of the Linux kernel.
	GuestNice uint64 // Time spent running a niced guest (virtual CPU for guest operating ystems under the control of the Linux kernel).
	Total     uint64 // not specified in /proc/stat
}

type Dirent

type Dirent struct {
	Inode  uint64
	Offset uint64
	Reclen uint16
	Type   byte
	Name   string
	IsEnd  bool
}

type DirentReader

type DirentReader struct {
	DataChan       chan Dirent
	Buffer         []byte
	Bufferx        []byte
	NameBuffer     []byte
	InternalDirent Dirent
	ExternalDirent Dirent
	BytesCounter   int
	IndexBuffer    int
	Cursor         int
}

func NewDirentReader

func NewDirentReader() *DirentReader

func (*DirentReader) Scan

func (d *DirentReader) Scan(fd *os.File)

type DiskStat

type DiskStat struct {
	MajorNumber      uint64
	MinorNumber      uint64
	Name             string
	ReadCompleted    uint64 // reads completed
	ReadMerged       uint64 // reads merged, field 6 -- # of writes merged
	SectorsRead      uint64 // sectors read
	ReadingSpent     uint64 // milliseconds spent reading
	WriteCompleted   uint64 // writes completed
	WriteMerged      uint64 // writes merged
	SectorsWritten   uint64 // sectors written
	WritingSpent     uint64 // milliseconds spent writing
	IOProgressing    uint64 // I/Os currently in progress
	IOSpent          uint64 // milliseconds spent doing I/Os
	WeightedIOSpent  uint64 // milliseconds spent doing I/Os (weighted)
	DiscardCompleted uint64 // discards completed
	DiscardMerged    uint64 // discards merged
	SectorDiscarded  uint64 // sectors discarded
	DiscardSpending  uint64 // milliseconds spent discarding
}

definition comes from Linux kernel /Documentation/iostats.txt

func (*DiskStat) Parse

func (ds *DiskStat) Parse(raw string) (err error)

type DiskStats

type DiskStats []*DiskStat

func NewDiskStats

func NewDiskStats() DiskStats

func (*DiskStats) Get

func (dss *DiskStats) Get() (err error)

type Fd

type Fd struct {
	Dirent
	Fresh bool
}

type FileInfo

type FileInfo struct {
	Path      string
	DiskUsage uint64
	NumFile   uint64
	NumDir    uint64
}

func GetFileInfo

func GetFileInfo(path string) (*FileInfo, error)

type IP

type IP struct {
	Host string
	Port string
}

func (IP) String

func (i IP) String() (str string)

type InetDiagMeminfo

type InetDiagMeminfo struct {
	IdiagRmem uint32
	IdiagWmem uint32
	IdiagFmem uint32
	IdiagTmem uint32
}

type InetDiagMessage

type InetDiagMessage struct {
	IdiagFamily  uint8
	IdiagState   uint8
	IdiagTimer   uint8
	IdiagRetrans uint8
	ID           InetDiagSockID
	IdiagExpires uint32
	IdiagRqueue  uint32
	IdiagWqueue  uint32
	IdiagUid     uint32
	IdiagInode   uint32
}

type InetDiagReq

type InetDiagReq struct {
	SdiagFamily   uint8
	SdiagProtocol uint8
	IdiagExt      uint8
	Pad           uint8
	IdiagStates   uint32
	ID            InetDiagSockID
}

type InetDiagRequest

type InetDiagRequest struct {
	Header  unix.NlMsghdr
	Request InetDiagReq
}

type InetDiagSockID

type InetDiagSockID struct {
	IdiagSport  uint16
	IdiagDport  uint16
	IdiagSrc    [4]uint32
	IdiagDst    [4]uint32
	IdiagIF     uint32
	IdiagCookie [2]uint32
}

type KernelVersion

type KernelVersion struct {
	Origin      string
	UTSSysName  string
	UTSRelease  string
	CompileBy   string
	CompileHost string
	Compiler    string
	UTSVersion  string
}

definition comes from Linux kernel /fs/proc/version.c

func (*KernelVersion) Get

func (kv *KernelVersion) Get() error

type MemoryInfo

type MemoryInfo struct {
	MemTotal          uint64
	MemFree           uint64
	MemAvailable      uint64
	Buffers           uint64
	Cached            uint64
	SwapCached        uint64
	Active            uint64
	Inactive          uint64
	ActiveAnon        uint64
	InactiveAnon      uint64
	ActiveFile        uint64
	InactiveFile      uint64
	Unevictable       uint64
	Mlocked           uint64
	HighTotal         uint64
	HighFree          uint64
	LowTotal          uint64
	LowFree           uint64
	MmapCopy          uint64
	SwapTotal         uint64
	SwapFree          uint64
	Dirty             uint64
	Writeback         uint64
	AnonPages         uint64
	Mapped            uint64
	Shmem             uint64
	KReclaimable      uint64
	Slab              uint64
	SReclaimable      uint64
	SUnreclaim        uint64
	KernelStack       uint64
	PageTables        uint64
	Quicklists        uint64
	NFSUnstable       uint64
	Bounce            uint64
	WritebackTmp      uint64
	CommitLimit       uint64
	CommittedAS       uint64
	VmallocTotal      uint64
	VmallocUsed       uint64
	VmallocChunk      uint64
	Percpu            uint64
	HardwareCorrupted uint64
	AnonHugePages     uint64
	ShmemHugePages    uint64
	ShmemPmdMapped    uint64
	CmaTotal          uint64
	CmaFree           uint64
	HugePagesTotal    uint64
	HugePagesFree     uint64
	HugePagesRsvd     uint64
	HugePagesSurp     uint64
	Hugepagesize      uint64
	DirectMap4k       uint64
	DirectMap2M       uint64
	DirectMap4M       uint64
	DirectMap1G       uint64
}

definition comes from Linux kernel /fs/proc/meminfo.c

func (*MemoryInfo) Get

func (mi *MemoryInfo) Get() error

type MountInfo

type MountInfo struct {
	ID             uint64 // a unique ID for the mount (may be reused after umount(2)).
	ParentID       uint64 // the ID of the parent mount (or of self for the root of this mount namespace's mount tree). If a new mount is stacked on top of a previous existing mount (so that it hides the existing mount) at pathname P, then the parent of the new mount is the previous mount at that location.  Thus, when looking at all the mounts stacked at a particular location, the top-most mount is the one that is not the parent of any other mount at the same location. (Note, however, that this top-most mount will be accessible only if the longest path subprefix of P that is a mount point is not itself hidden by a stacked mount.) If the parent mount point lies outside the process's root directory (see chroot(2)), the ID shown here won't have a corresponding record in mountinfo whose mount ID (field 1) matches this parent mount ID (because mount points that lie outside the process's root directory are not shown in mountinfo). As a special case of this point, the process's root mount point may have a parent mount (for the initramfs filesystem) that lies outside the process's root directory, and an entry for that mount point will not appear in mountinfo.
	DiskMajorNum   uint64 // the value of st_dev for files on this filesystem (see stat(2)).
	DiskMinorNum   uint64
	FileSystemRoot string // the pathname of the directory in the filesystem which forms the root of this mount.
	MountPoint     string // the pathname of the mount point relative to the process's root directory.
	MountOptions   string // per-mount options (see mount(2)).
	OptionalFields string // zero or more fields of the form "tag[:value]"; see below.
	FilesystemType string // the filesystem type in the form "type[.subtype]".
	MountSource    string // filesystem-specific information or "none".
	SuperOptions   string // per-superblock options (see mount(2)).
}

definition comes from http://man7.org/linux/man-pages/man5/proc.5.html

func (*MountInfo) Parse

func (mi *MountInfo) Parse(raw string) (err error)

type MountInfos

type MountInfos []*MountInfo

func NewMountInfos

func NewMountInfos() MountInfos

func (*MountInfos) Get

func (mis *MountInfos) Get() error

type NetDev

type NetDev struct {
	Interface          string
	ReceiveBytes       uint64
	ReceivePackets     uint64
	ReceiveErrs        uint64
	ReceiveDrop        uint64
	ReceiveFifo        uint64
	ReceiveFrame       uint64
	ReceiveCompressed  uint64
	ReceiveMulticast   uint64
	TransmitBytes      uint64
	TransmitPackets    uint64
	TransmitErrs       uint64
	TransmitDrop       uint64
	TransmitFifo       uint64
	TransmitColls      uint64
	TransmitCarrier    uint64
	TransmitCompressed uint64
}

func (*NetDev) Parse

func (nd *NetDev) Parse(raw string) (err error)

type NetDevs

type NetDevs map[string]*NetDev

func NewNetDevs

func NewNetDevs() NetDevs

func (*NetDevs) Get

func (nds *NetDevs) Get() error

type ProcInfo

type ProcInfo struct {
	Cmdline []string
	Stat    ProcStat
	IsEnd   bool
}

func NewProcInfo

func NewProcInfo() *ProcInfo

func (*ProcInfo) GetCmdline

func (p *ProcInfo) GetCmdline() error

func (*ProcInfo) GetFds

func (p *ProcInfo) GetFds() (err error)

func (*ProcInfo) GetStat

func (p *ProcInfo) GetStat() (err error)

type ProcStat

type ProcStat struct {
	Pid                 int
	Name                string // The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out.
	State               byte   // single-char code for process state
	Ppid                int    // The PID of the parent of this process.
	Pgrp                int    // The process group ID of the process.
	Session             int    // The session ID of the process.
	TtyNr               int    // The controlling terminal of the process. (The minor device number is contained in the combination of bits 31 to 20 and 7 to 0; the major device number is in bits 15 to 8)
	Tpgid               int    // The ID of the foreground process group of the controlling terminal of the process.
	Flags               uint32 // The kernel flags word of the process. For bit meanings, see the PF_* defines in the Linux kernel source file include/linux/sched.h. Details depend on the kernel version.
	Minflt              uint64 // The number of minor faults the process has made which have not required loading a memory page from disk
	Cminflt             uint64 // The number of minor faults that the process's waited-for children have made
	Majflt              uint64 // The number of major faults the process has made which have required loading a memory page from disk
	Cmajflt             uint64 // The number of major faults that the process's waited-for children have made
	Utime               uint64 // Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)). This includes guest time, so that applications that are not aware of the guest time field do not lose that time from their calculations.
	Stime               uint64 // Amount of time that this process has been scheduled in kernel mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	Cutime              uint64 // Amount of time that this process's waited-for children have been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)). This includes guest time, cguest_time.
	Cstime              uint64 // Amount of time that this process's waited-for children have been scheduled in kernel mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	Priority            int64  // For processes running a real-time scheduling policy, this is the negated scheduling priority, minus one; that is, a number in the range -2 to -100, corresponding to real-time priorities 1 to 99. For processes running under a non-real-time scheduling policy, this is the raw nice value as represented in the kernel. The kernel stores nice values as numbers in the range 0 (high) to 39 (low), corresponding to the user-visible nice range of -20 to 19.
	Nice                int64  // The nice value, a value in the range 19 (low priority) to -20 (high priority).
	NumThreads          int64  // Number of threads in this process (since Linux 2.6).
	Itrealvalue         int64  // Obsolete
	Starttime           uint64 // The time the process started after system boot. In kernels before Linux 2.6, this value was expressed in jiffies. Since Linux 2.6, the value is expressed in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	Vsize               uint64 // Virtual memory size in bytes.
	Rss                 int64  // Resident Set Size: number of pages the process has in real memory. This is just the pages which count toward text, data, or stack space. This does not include pages which have not been demand-loaded in, or which are swapped out.
	Rsslim              uint64 // Current soft limit in bytes on the rss of the process
	Startcode           uint64 // The address above which program text can run.
	Endcode             uint64 // The address below which program text can run.
	Startstack          uint64 // The address of the start (i.e., bottom) of the stack.
	Kstkesp             uint64 // The current value of ESP (stack pointer), as found in the kernel stack page for the process.
	Kstkeip             uint64 // The current EIP (instruction pointer).
	Signal              uint64 // Obsolete
	Blocked             uint64 // Obsolete
	Sigignore           uint64 // Obsolete
	Sigcatch            uint64 // Obsolete
	Wchan               uint64 // This is the "channel" in which the process is waiting. It is the address of a location in the kernel where the process is sleeping. The corresponding symbolic name can be found in /proc/[pid]/wchan.
	Nswap               uint64 // Obsolete
	Cnswap              uint64 // Obsolete
	ExitSignal          int    // Signal to be sent to parent when we die
	Processor           int    // CPU number last executed on
	RtPriority          uint64 // Real-time scheduling priority, a number in the range 1 to 99 for processes scheduled under a real-time policy, or 0, for non-real-time processes .
	Policy              uint32 // Scheduling policy. Decode using the SCHED_* constants in linux/sched.h.
	DelayacctBlkioTicks uint64 // Aggregated block I/O delays, measured in clock ticks (centiseconds).
	GuestTime           uint64 // Guest time of the process (time spent running a virtual CPU for a guest operating system), measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	CguestTime          int64  // Guest time of the process's children, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	StartData           uint64 // Address above which program initialized and uninitialized (BSS) data are placed.
	EndData             uint64 // Address below which program initialized and uninitialized (BSS) data are placed.
	StartBrk            uint64 // Address above which program heap can be expanded with brk(2).
	ArgStart            uint64 // Address above which program command-line arguments (argv) are placed.
	ArgEnd              uint64 // Address below program command-line arguments (argv) are placed.
	EnvStart            uint64 // Address above which program environment is placed.
	EnvEnd              uint64 // Address below which program environment is placed.
	ExitCode            int    // The thread's exit status.
}

type SocketInfo

type SocketInfo struct {
	// Generic
	LocalAddr  IP
	RemoteAddr IP
	Status     uint8
	TxQueue    uint32
	RxQueue    uint32
	Timer      int
	Timeout    int
	Retransmit int
	UID        uint64
	Probes     int // unanswered 0-window probes
	Inode      uint32
	RefCount   int
	SK         uint64
	// /proc/net/tcp or /proc/net/tcp6 specific
	RTO                float64  // RetransmitTimeout
	ATO                float64  // Predicted tick of soft clock (delayed ACK control data)
	QACK               int      // (ack.quick<<1)|ack.pingpong
	CongestionWindow   int      // sending congestion window
	SlowStartThreshold int      // slow start size threshold, or -1 if the threshold is >= 0xFFFF
	Opt                []string // Option Info
	// Internal TCP information
	TCPInfo   *TCPInfo
	VegasInfo *TCPVegasInfo
	CONG      []byte
	// Extended Info
	Drops   int   // Generic like UDP, RAW specific
	Type    uint8 // socket type
	Meminfo []uint32
	// Related processes
	UserName string
	// Flag
	IsEnd bool
}

func NewSocketInfo

func NewSocketInfo() *SocketInfo

func (*SocketInfo) ExtendInfoPrint

func (si *SocketInfo) ExtendInfoPrint()

func (*SocketInfo) GenericInfoPrint

func (si *SocketInfo) GenericInfoPrint()

func (*SocketInfo) MeminfoPrint

func (si *SocketInfo) MeminfoPrint()

func (*SocketInfo) ProcInfoPrint

func (si *SocketInfo) ProcInfoPrint()

func (*SocketInfo) Reset

func (si *SocketInfo) Reset()

func (*SocketInfo) SetUpRelation

func (si *SocketInfo) SetUpRelation()

func (*SocketInfo) TCPInfoPrint

func (si *SocketInfo) TCPInfoPrint()

func (*SocketInfo) TimerInfoPrint

func (si *SocketInfo) TimerInfoPrint()

type SystemStat

type SystemStat struct {
	CPUTotal        *CPUJiffies
	PageIn, PageOut uint64 // The number of pages the system paged in and the number that were paged out (from disk).
	SwapIn, SwapOut uint64 // The number of swap pages that have been brought in and out.
	Intr            uint64 // This line shows counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all interrupts serviced including unnumbered architecture specific interrupts; each subsequent column is the total for that particular numbered interrupt. Unnumbered interrupts are not shown, only summed into the total.
	Ctxt            uint64 // The number of context switches that the system underwent.
	Btime           uint64 // boot time, in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
	Processes       uint64 // Number of forks since boot.
	ProcsRunning    uint64 // Number of processes in runnable state. (Linux 2.5.45 onward.)
	ProcsBlocked    uint64 // Number of processes blocked waiting for I/O to complete. (Linux 2.5.45 onward.)
}

definition comes from Linux kernel /fs/proc/stat.c

func (*SystemStat) Get

func (ss *SystemStat) Get() (err error)

type TCPInfo

type TCPInfo struct {
	State           uint8
	Ca_state        uint8
	Retransmits     uint8
	Probes          uint8
	Backoff         uint8
	Options         uint8
	Pad_cgo_0       [2]byte
	Rto             uint32
	Ato             uint32
	Snd_mss         uint32
	Rcv_mss         uint32
	Unacked         uint32
	Sacked          uint32
	Lost            uint32
	Retrans         uint32
	Fackets         uint32
	Last_data_sent  uint32
	Last_ack_sent   uint32
	Last_data_recv  uint32
	Last_ack_recv   uint32
	Pmtu            uint32
	Rcv_ssthresh    uint32
	Rtt             uint32
	Rttvar          uint32
	Snd_ssthresh    uint32
	Snd_cwnd        uint32
	Advmss          uint32
	Reordering      uint32
	Rcv_rtt         uint32
	Rcv_space       uint32
	Total_retrans   uint32
	Pacing_rate     uint64
	Max_pacing_rate uint64
	Bytes_acked     uint64 /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
	Bytes_received  uint64 /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
	Segs_out        uint32 /* RFC4898 tcpEStatsPerfSegsOut */
	Segs_in         uint32 /* RFC4898 tcpEStatsPerfSegsIn */
	Notsent_bytes   uint32
	Min_rtt         uint32
	Data_segs_in    uint32 /* RFC4898 tcpEStatsDataSegsIn */
	Data_segs_out   uint32 /* RFC4898 tcpEStatsDataSegsOut */
	Delivery_rate   uint64
	Busy_time       uint64 /* Time (usec) busy sending data */
	Rwnd_limited    uint64 /* Time (usec) limited by receive window */
	Sndbuf_limited  uint64 /* Time (usec) limited by send buffer */
}

type TCPVegasInfo

type TCPVegasInfo struct {
	Enabled uint32
	Rttcnt  uint32
	Rtt     uint32
	Minrtt  uint32
}

type UnixDiagMessage

type UnixDiagMessage struct {
	UdiagFalimy uint8
	UdiagType   uint8
	UdiagState  uint8
	Pad         uint8
	UdiagIno    uint32
	UdiagCookie [2]uint32
}

type UnixDiagRQlen

type UnixDiagRQlen struct {
	RQ uint32
	WQ uint32
}

type UnixDiagReq

type UnixDiagReq struct {
	SdiagFamily   uint8
	SdiagProtocol uint8
	Pad           uint16
	UdiagStates   uint32
	UdiagIno      uint32
	UdiagShow     uint32
	UdiagCookie   [2]uint32
}

type UnixDiagRequest

type UnixDiagRequest struct {
	Header  unix.NlMsghdr
	Request UnixDiagReq
}

type UnixDiagVFS

type UnixDiagVFS struct {
	Dev uint32
	Ino uint32
}

type Uptime

type Uptime struct {
	Uptime float64
	Idle   float64
}

definition comes from Linux kernel /fs/proc/uptime.c

func (*Uptime) Get

func (ut *Uptime) Get() error

Jump to

Keyboard shortcuts

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