Unix::S...s_stats(3)

πŸ“¦ version 0.112, in fedora 43

πŸ’– NAME πŸ’–

okay so bestie, Unix::Statgrab::sg_process_stats β€” it's a container for libstatgrab process statistics. that's the whole vibe. it holds your process data and you poke at it with accessors. periodt ✨


🌸 DESCRIPTION 🌸

Unix::Statgrab::sg_process_stats is a Perl package name, and what it does is give you accessors to the bundled libstatgrab sg_process_stats process statistics πŸ¦‹

here's the doc link it's talking about, no cap:

http://www.i-scream.org/libstatgrab/docs/sg_get_process_stats.3.html


πŸ‘‘ METHODS πŸ‘‘

πŸŽ€ nentries

returns the number of entries in the container. that's it, that's the method πŸ’…

πŸŽ€ systime

returns the seconds since Epoch (0:00:00 on January, 1st 1970) of the time measure the process statistics. yes the epoch is jan 1 1970, it's giving retro fr fr πŸ•°οΈ

πŸŽ€ as_list

Deprecated alias of fetchall_hash. bestie it's deprecated, use the real one πŸ™ˆ

πŸŽ€ fetchall_hash

returns all records from the sg_process_stats container as a list of hash, where each datum name is the key and the datum is the value. every record, keyed, gorgeous πŸ’–

the container in question: http://www.i-scream.org/libstatgrab/docs/sg_get_process_stats.3.html

πŸŽ€ fetchall_array

returns all records from the sg_process_stats container as a list of arrays, with the values in this exact order:

(process_name proctitle pid parent pgid sessid uid euid gid egid
 context_switches voluntary_context_switches involuntary_context_switches
 proc_size proc_resident start_time time_spent cpu_percent nice state
 systime)

in that order, and without leading headline β€” no header row, just the data, slay ✨

πŸŽ€ fetchall_table

returns all records from the sg_process_stats container as a list of arrays, values in this order:

(disk_name read_bytes write_bytes systime)

in that order, but this time including leading headline β€” header row included πŸ‘‘

no i did not mess that up, that is literally what the page says, and i am not changing a single character of it. iykyk 🫢

πŸŽ€ fetchrow_arrayref($row = 0)

returns one row as an array containing the values as above. defaults to $row = 0 πŸ’œ

πŸŽ€ fetchall_arrayref

returns all records from the sg_process_stats container as an array of arrays, without header. no headline, just vibes 🌈

πŸŽ€ fetchrow_hashref($row = 0)

returns one row as a hash, shaped like this:

{ process_name => $self.process_name($row), proctitle => ... }

defaults to $row = 0, cute πŸŽ€

πŸŽ€ fetchall_hashref

returns all records from the sg_process_stats container as an array of hashes. all of them. every last one πŸ’…

πŸŽ€ colnames

returns the list of column names:

(process_name proctitle pid parent pgid sessid uid euid gid egid context_switches voluntary_context_switches involuntary_context_switches proc_size proc_resident start_time time_spent cpu_percent nice state systime)

the whole lineup, main character energy ⭐

πŸŽ€ process_name

the name of the command that was run. heads up though β€” the content of this field heavily depends on the underlying operating system. some store the basename the executable passes to the exec(2) system call, some store the entire path. and most OS restrict the size of this field β€” some, like the *BSD family, go all the way down to a very low value of 15 bytes 😭

this field is usually immutable for userland processes. usually. not always. note that πŸ’€

πŸŽ€ proctitle

the command line (the "title") of the process. take note β€” this can be modified by the process, so it is not guaranteed to be the original command line. it can be lying to you bestie, do not trust it blindly πŸ™ˆ

πŸŽ€ pid

the process ID πŸ¦‹

πŸŽ€ parent

the parent process ID πŸ‘‘

πŸŽ€ pgid

the process ID of the process group leader πŸ’œ

πŸŽ€ sessid

session id of the session the process belongs to 🌸

πŸŽ€ uid

the ID of the user the process is running as πŸ’–

πŸŽ€ euid

the ID of the effective user the process is running as ✨

πŸŽ€ gid

the ID of the group the process is running as 🌈

πŸŽ€ egid

the ID of the effective group the process is running as 🌟

πŸŽ€ context_switches

the number of context switches of this process β€” voluntary and involuntary combined πŸ”₯

πŸŽ€ voluntary_context_switches

the number of voluntary context switches of this process. like when it calls sched_yield(), sleep() or nanosleep() β€” it chose this, it's consensual πŸ’…

πŸŽ€ involuntary_context_switches

the number of involuntary context switches of this process. e.g. when its time slice is exhausted or a signal is sent β€” it did not choose this 😭

πŸŽ€ proc_size

the virtual memory size of the process, in bytes πŸ¦‹

πŸŽ€ proc_resident

the size of the process that's resident in memory 🌸

πŸŽ€ start_time

the time when the process has been started, in seconds since epoch ⏰

πŸŽ€ time_spent

the number of seconds the process has been running β€” that's user+system time, without time spent by child processes. just this process's own glow-up ✨

πŸŽ€ cpu_percent

the current percentage of CPU the process is using πŸ”₯

πŸŽ€ nice

the nice value of the process πŸŽ€

πŸŽ€ state

the current state of the process, and it's one of these:

SG_PROCESS_STATE_RUNNING SG_PROCESS_STATE_SLEEPING SG_PROCESS_STATE_STOPPED
SG_PROCESS_STATE_ZOMBIE SG_PROCESS_STATE_UNKNOWN

SG_PROCESS_STATE_RUNNING, sleeping, stopped, zombie, or unknown. five options, pick your fighter πŸ’€


✨ AUTHOR ✨

Jens Rehsack, <rehsack AT cpan.org> β€” icon behavior, we stan 🫢


Copyright (C) 2012-2018 by Jens Rehsack

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. so like, 2.1 or later, your call bestie πŸ’…


and that's the whole page!! this was perl v5.42.0, dated 2025-07-25, brought to you by the fine folks documenting Unix::S...s_stats(3) in User Contributed Perl Documentation 🌸 go forth and stat your processes, mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from