proc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures. It is commonly mounted at /proc. Most of it is read-only, but some files allow kernel variables to be changed.

kernel/system statistics. Varies with architecture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPids

func AllPids() []string

return all pids in Ctx.Procfs

func AllThreadPids

func AllThreadPids(pid string) []string

Types

type BuddyInfoInfo

type BuddyInfoInfo struct {
	Zones []BuddyInfoZone
}

func BuddyInfo

func BuddyInfo() (BuddyInfoInfo, error)

type BuddyInfoZone

type BuddyInfoZone struct {
	Node  string
	Type  string
	Pages []uint64 // Linux 通过 buddy 算法,把所有空闲的内存,以2的幂次方的形式,分成 11 个块链表,

}

type CPU

type CPU struct {
	Name       string // 0. CPU name: cpu, cpu0, cpu1
	User       uint64 // 1. Time spent in user mode.
	Nice       uint64 // 2. Time spent in user mode with low priority (nice).
	System     uint64 // 3. Time spent in system mode.
	Idle       uint64 // 4. Time spent in the idle task. This value should be USER_HZ times the second entry in the /proc/uptime pseudo-file.
	Iowait     uint64 // 5. Time waiting for I/O to complete.(since Linux 2.5.41)
	Irq        uint64 // 6. Time servicing interrupts.(since Linux 2.6.0-test4)
	Softirq    uint64 // 7. Time servicing softirqs.(since Linux 2.6.0-test4)
	Steal      uint64 // 8. Stolen time, which is the time spent in other operating systems when running in a virtualized environment(since Linux 2.6.11)
	Guest      uint64 // 9. Time spent running a virtual CPU for guest operating systems under the control of the Linux kernel.(since Linux 2.6.24)
	Guest_nice uint64 // 10. Time spent running a niced guest (virtual CPU for guest operating systems under the  control  of the Linux kernel).(since Linux 2.6.33
}

type Context

type Context struct {
	Procfs string
}
var Ctx Context

type Meminfo

type Meminfo 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
	SwapTotal         uint64
	SwapFree          uint64
	Dirty             uint64
	Writeback         uint64
	AnonPages         uint64
	Mapped            uint64
	Shmem             uint64
	Slab              uint64
	SReclaimable      uint64
	SUnreclaim        uint64
	KernelStack       uint64
	PageTables        uint64
	NfsUnstable       uint64
	Bounce            uint64
	WritebackTmp      uint64
	CommitLimit       uint64
	CommittedAS       uint64
	VmallocTotal      uint64
	VmallocUsed       uint64
	VmallocChunk      uint64
	HardwareCorrupted uint64
	AnonHugePages     uint64
	CmaTotal          uint64
	CmaFree           uint64
	HugePagesTotal    uint64
	HugePagesFree     uint64
	HugePagesRsvd     uint64
	HugePagesSurp     uint64
	Hugepagesize      uint64
	DirectMap4k       uint64
	DirectMap2M       uint64
	DirectMap1G       uint64
}

unit of mem info is KB

func GetMeminfo

func GetMeminfo() (Meminfo, error)

type StatInfo

type StatInfo struct {
	CPUs    []CPU    // All CPUs info, CPUs[0] is total num, 1-len(CPUS)-1 is cores; CPUs: sum, cpu0, cpu1...
	PageIn  uint64   // The number of pages the system paged in (from disk).
	PageOut uint64   // The number of pages the system that were paged out (from disk).
	SwapIn  uint64   // The number of swap pages that have been brought in .
	SwapOut uint64   // The number of swap pages that have been brought 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.
	//disk_io	[]uint64	// (Linux 2.4 only), Not support here
	Ctxt         uint64 // The number of context switches that the system underwent.
	BootTime     uint64 // boot time, in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
	Processes    uint64 // Number of processes in runnable state.  (Linux 2.5.45 onward.)
	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.)
}

func Stat

func Stat() (StatInfo, error)

type UpTimeInfo

type UpTimeInfo struct {
	Uptime   float64 // the uptime of the system (seconds)
	IdleTime float64 // the amount of time spent in idle process (seconds)
}

func UpTime

func UpTime() (UpTimeInfo, error)

Directories

Path Synopsis
The dev pseudo-file contains network device status information.
The dev pseudo-file contains network device status information.
Controlling which mappings are written to the core dump Since kernel 2.6.23, the Linux-specific /proc/[pid]/coredump_filter file can be used to control which memory segments are written to the core dump file in the event that a core dump is performed for the process with the corresponding process ID.
Controlling which mappings are written to the core dump Since kernel 2.6.23, the Linux-specific /proc/[pid]/coredump_filter file can be used to control which memory segments are written to the core dump file in the event that a core dump is performed for the process with the corresponding process ID.

Jump to

Keyboard shortcuts

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