Unix::S...percents(3)

πŸ“¦ version 0.112, in fedora 43

✨ 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 (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