Sys::Simple is a set of functions and perl modules that retrieve information about the local system. The goal is to have light and simple functions, that has a simple scopped answer.
version 0.001
use Sys::Simple qw/ list of functions/; function();
OR
you can use a given function directly using the full namespace:
use Sys::Simple::CPU::Linux; Sys::Simple::CPU::Linux::cpu_usage();
None of the functions are exported by default
Returns the amount of the cpu being used on the machine. If the machine have more than one cpu or cores, it will count all processing power as one and give the percentage used from the pool. By example a given machine with 4 cpus with three of them idle and one at full use will return 0.25. To have the total percentage you must multiply the value by 100;
The way it calculates use a wait of 10 miliseconds, but if more time is necessary you can pass a numeric argument and this will multiply the 10 miliseconds used as interval to calculate the cpu_usage.
There is other modules all over CPAN that does almost the same, this one is different because really does not create an object, or requires setup, or whatever, call it and return the usage.
Github: https://github.com/fredericorecsky/Sys-Simple
Frederico Recsky <recsky@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sys::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Simple
CPAN shell
perl -MCPAN -e shell install Sys::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.