Documentation
¶
Index ¶
- type PrintOption
- type Printer
- type ProcessTree
- func (pt *ProcessTree) Add(td *unmarshal.TaskDescriptor)
- func (pt *ProcessTree) All() []*unmarshal.TaskDescriptor
- func (pt *ProcessTree) BuildLineageSubtree(pids []int32) (*ProcessTree, error)
- func (pt *ProcessTree) Children(pid int32) []int32
- func (pt *ProcessTree) ChildrenSorted(pid int32) []int32
- func (pt *ProcessTree) FindRoots() []int32
- func (pt *ProcessTree) Get(pid int32) *unmarshal.TaskDescriptor
- func (pt *ProcessTree) GetLineage(pid int32) ([]*unmarshal.TaskDescriptor, error)
- func (pt *ProcessTree) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrintOption ¶
func WithColors ¶
func WithColors(colored bool) PrintOption
WithColors returns an option that enables or disables colored output.
func WithContainers ¶
func WithContainers(mgr *containers.Manager) PrintOption
WithContainers returns an option that sets the container manager for container labels.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer handles tree printing with various options.
func NewPrinter ¶
func NewPrinter(pt *ProcessTree, opts ...PrintOption) *Printer
NewPrinter creates a new Printer for the given tree.
func (*Printer) PrintFiltered ¶
PrintFiltered prints only the specified PIDs and their descendants.
func (*Printer) PrintLineages ¶
PrintLineages prints merged lineages of multiple PIDs.
func (*Printer) PrintSubtree ¶
PrintSubtree prints the subtree rooted at the given PID.
type ProcessTree ¶
type ProcessTree struct {
// contains filtered or unexported fields
}
ProcessTree represents a tree of processes indexed by PID.
func (*ProcessTree) Add ¶
func (pt *ProcessTree) Add(td *unmarshal.TaskDescriptor)
Add inserts a process into the tree.
func (*ProcessTree) All ¶
func (pt *ProcessTree) All() []*unmarshal.TaskDescriptor
All returns all TaskDescriptors in the tree.
func (*ProcessTree) BuildLineageSubtree ¶
func (pt *ProcessTree) BuildLineageSubtree(pids []int32) (*ProcessTree, error)
BuildLineageSubtree creates a new tree containing only nodes in the lineages of the given PIDs.
func (*ProcessTree) Children ¶
func (pt *ProcessTree) Children(pid int32) []int32
Children returns the child PIDs of a given process.
func (*ProcessTree) ChildrenSorted ¶
func (pt *ProcessTree) ChildrenSorted(pid int32) []int32
ChildrenSorted returns the child PIDs sorted numerically.
func (*ProcessTree) FindRoots ¶
func (pt *ProcessTree) FindRoots() []int32
FindRoots returns PIDs of processes that are tree roots. A root is a process whose parent is not in the tree.
func (*ProcessTree) Get ¶
func (pt *ProcessTree) Get(pid int32) *unmarshal.TaskDescriptor
Get returns a process by PID, or nil if not found.
func (*ProcessTree) GetLineage ¶
func (pt *ProcessTree) GetLineage(pid int32) ([]*unmarshal.TaskDescriptor, error)
GetLineage returns the ancestry of a process from root to the given PID.
func (*ProcessTree) Size ¶
func (pt *ProcessTree) Size() int
Size returns the number of processes in the tree.