Unix::S...percents(3)
β¨ NAME β¨
ok so bestie, welcome to Unix::Statgrab::sg_cpu_percents β it's a Perl package (from the Unix::S...percents(3) man page, the whole Unix::Statgrab gang π) and it's literally just a cute lil container for the libstatgrab CPU percent collection. that's the whole job. she holds the numbers. she slays at it.
πΈ DESCRIPTION πΈ
Unix::Statgrab::sg_cpu_percents is a Perl package name that hands you accessors to the bundled libstatgrab sg_cpu_percents data collection. the docs for that live over at http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html if you wanna go read the source material, iykyk π¦
π METHODS π
nentries
returns the number of entries in the container. like, how many lil guys are in there. bestie math. β¨
time_taken
returns the seconds since Epoch (0:00:00 on January, 1st 1970 π) of the time the CPU statistics were measured. so it's a timestamp, not a duration β don't get it twisted.
as_list
Deprecated alias of fetchall_hash. it's giving legacy code energy, use the new one π
fetchall_hash
returns ALL the records from the sg_cpu_percents container as a list of hashes. each hash has the datum name as the key and the datum itself as the value. super readable, obsessed. π
fetchall_array
returns all records from the sg_cpu_percents container as a list of arrays, with the values in this exact order:
(user kernel idle iowait swap nice time_taken)
in that order, and without a leading headline. no header row, no preamble, just the goods. β¨
fetchall_table
returns all records from the sg_cpu_percents container as a list of arrays, same order as above:
(user kernel idle iowait swap nice time_taken)
in that order, but including the leading headline this time. so it's the table-y version, header and all. π
fetchrow_arrayref($row = 0)
returns one row as an array, with the values in the same order as above. and yeah, $row defaults to 0 if you don't pass anything. β¨
fetchall_arrayref
returns all records from the sg_cpu_percents container as an array of arrays, without the header. no headline, just vibes. π
fetchrow_hashref($row = 0)
returns one row as a hash shaped like { user => $self.user($row), kernel => ... }. yes the $row default is 0 here too, we love consistency. π«Ά
fetchall_hashref
returns all records from the sg_cpu_percents container as an array of hashes. all of them. every last one. π
colnames
returns the list of column names: (user kernel idle iowait swap nice time_taken) β that's your header lineup bestie, memorize it π
user
percentage of CPU times spent in user mode β¨
kernel
percentage of CPU times spent in kernel mode πΈ
idle
percentage of CPU times being idle π΄ (main character energy of doing absolutely nothing, we respect it)
iowait
percentage of CPU times waiting for I/O π¦
swap
percentage of CPU times spent for swapping π
nice
percentage of CPU times spent in user mode with nice priority π
π AUTHOR π
Jens Rehsack, <rehsack AT cpan.org>
π COPYRIGHT AND LICENSE π
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.
fr fr that's the whole license blurb, don't skip it, LGPL 2.1 or later, bestie π
ok that's the page!! this was perl v5.42.0, dated 2025-07-25, and the man page itself is Unix::S...percents(3) β mwah, go read your CPU percents, you deserve it π
β¨π«Ά
π¦ where this page comes from
- fedora 43: perl-Unix-Statgrab 0.112-27.fc43 Β· (LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl))
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms