Sys-CpuLoad-0.32/0000775000175000017500000000000014771760546011414 5ustar rrrrSys-CpuLoad-0.32/META.json0000644000175000017500000000561314771760546013040 0ustar rrrr{ "abstract" : "retrieve system load averages", "author" : [ "Robert Rothenberg ", "Clinton Wong " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010", "keywords" : [ "CPU", "load", "average", "loadavg", "system" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Sys-CpuLoad", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" }, "suggests" : { "JSON::PP" : "2.27300" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::EOF" : "0", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::MinimumVersion" : "0", "Test::More" : "0.88", "Test::NoTabs" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Pod::LinkCheck" : "0", "Test::Portability::Files" : "0", "Test::TrailingSpace" : "0.0203" } }, "runtime" : { "requires" : { "Exporter" : "0", "File::Which" : "0", "IO::File" : "0", "IPC::Run3" : "0", "XSLoader" : "0", "parent" : "0", "perl" : "v5.6.0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "File::Spec" : "0", "Module::Metadata" : "0", "Scalar::Util" : "0", "Test::Deep" : "0", "Test::Exception" : "0", "Test::More" : "0", "Test::Warnings" : "0" } } }, "provides" : { "Sys::CpuLoad" : { "file" : "lib/Sys/CpuLoad.pm", "version" : "0.32" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/robrwo/Sys-CpuLoad/issues" }, "homepage" : "https://metacpan.org/release/Sys-CpuLoad", "repository" : { "type" : "git", "url" : "git://github.com/robrwo/Sys-CpuLoad.git", "web" : "https://github.com/robrwo/Sys-CpuLoad" } }, "version" : "0.32", "x_authority" : "cpan:RRWO", "x_contributors" : [ "Slaven Rezi\u0107 ", "Victor Wagner", "Dmitry Dorofeev ", "Vincent Lef\u00e8vre " ], "x_generated_by_perl" : "v5.34.3", "x_serialization_backend" : "Cpanel::JSON::XS version 4.38", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Sys-CpuLoad-0.32/SIGNATURE0000644000175000017500000001040214771760546012673 0ustar rrrrThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.89. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 SHA256 4a27077e160b88ef36d5687505265ecc45cb81d618430b2ed3430a4b998b7718 Changes SHA256 7ea146b46a6db191ebb4c04a8f04a5cbb1a37e5c240e053fce579a0538d2c5c4 CpuLoad.xs SHA256 394bb4c297b6fe9a540506c9ad5d3360d9543b90cae94b236f0bf7a27172c2a8 INSTALL SHA256 82e07478f53b47a9a224075b9c17d928a7cf7acfffb1b889b8f681ac689c159f LICENSE SHA256 643022787cb34a1aae60c2000b4c101c5670c10643acede356d637b84a2df6fc MANIFEST SHA256 5cae424aaf81f9a20a69ec0944a3f2b466aea7c4f8e4f17a98e0d3675027dba8 META.json SHA256 0c5d8fee77e7bf173478a538db4c11bbe079df3008c5b45eec64f1796c6ab0e4 META.yml SHA256 7963715449ef0b3e76e050ad78f2d5a74d9c3afce809d0b345dcb56c95f27be0 Makefile.PL SHA256 466200a4652266fcffe62335f531c25293f6c0daa55147a6822452d28affe05f README.md SHA256 84fdf7f1fc7e9b375d7eff6354704accd1ba93274f7463969c3f371a7587ca97 SECURITY.md SHA256 d30ca8bc8f6832bb96ffdc983d54e6d870b2a70387a7793be35a52608c6d67b0 cpanfile SHA256 e4038c8f2b2cff825f06339fa92f80f22365243efcae89488ca545ecbf57285c dist.ini SHA256 322653829854aa58a1fe16d908e08d507bad93f7603d1ec424d2ea3af2363c03 lib/Sys/CpuLoad.pm SHA256 1ba25d606e2ca7ba8415c1c9442b10f372ab96cceb13d09ca14a7fdb23dd803b t/00-report-prereqs.dd SHA256 a09abf0f981c4a98250030a586579bd1ed1a78a2e3eecbcdaf9757213a18ca0f t/00-report-prereqs.t SHA256 68df9420ac0bb14880178af541da565671e6f4f2aee7f88202df8928cc2c6728 t/01-basic.t SHA256 db9e480530c7dad389ff7205ae3ba7fed0c3b14bd6d4e823280c977147f07895 t/02-legacy.t SHA256 57c65539562189d725505aaca512157c5407084525461496c896bccdd8a7649f t/10-getloadavg.t SHA256 ff499e267df66e132824b1d73182e9eec74287b159c111db26213e3d0e1531ff t/11-proc_loadavg.t SHA256 d2df98b83b7c39435f658d6dad29000799d50b22046f1819fcf568a11e2e39dd t/12-uptime.t SHA256 44f956784bf90877e3946c463286cdb3430a0bd2e6f07bc1096a0bcd087ac1f1 t/13-w.t SHA256 dde553170822a85283b97afa0cb1a0e14fc63338cdb985174c68a2f5b48ee7e8 t/20-load.t SHA256 e5bab84ea3bf87c793fd33295c79e6a96f9286dfb61e95658fc07f77323c6d11 t/author-critic.t SHA256 fbe6cdd54a8c2e95b5eb624cdc1799f9ea3d28e4fca551e23738cf9a0a829e32 t/author-eof.t SHA256 5e8da4dfab0efafa590eee30bfadcaeb7d7fffa605e3504620dd093906992e81 t/author-eol.t SHA256 914bde9f0ea3cadd6afb992b32d87f5027d1a0921b6b8fec75db045bac31956e t/author-minimum-version.t SHA256 9813478fa228e7de2a413c6e962f2d5fb661909faabad647c2182f6c3b29c731 t/author-no-tabs.t SHA256 1ee64d4f8248deb3541453ec521ac8057c9a4ba365946b6a02ee760ad28ce164 t/author-pod-coverage.t SHA256 8835ccb71da79a1b53a576dd349e188d444fce139e1f9f62976458c066b8edf9 t/author-pod-linkcheck.t SHA256 305c657c6b73f10767a0ea286b8a73d693940f4cbb8b6a0a4d34e2b5a1c04635 t/author-pod-syntax.t SHA256 da2b42d19f0e73aaab56a0bb5dffc2d761be48ee53e305c7fe9f0921279fa2a1 t/author-portability.t SHA256 5f2d6449732e237e7bbf1f7e6ebd51f0f09ebf6ecef2ba7dbc6c0a226a2448bb t/etc/perlcritic.rc SHA256 6817b484798f726a44e9aee17da6e80979b4ace77349f0d0b4a13cd935172cba t/release-fixme.t SHA256 426c441a368792fa6be6a2e35ff0ac997faa48575d090646e9570e056109bb32 t/release-kwalitee.t SHA256 6157040bb26db4ca06dd9c19043099fe31004612d27961308558fa2e3e6a7bbe t/release-trailing-space.t SHA256 fa270029e5470b55008483d8c171bc2b2d7f105ec56aeaa0aa8253d9447e694e weaver.ini -----BEGIN PGP SIGNATURE----- iQGzBAEBAwAdFiEEeIwq7Pfyfxtssr5nHmWrcYGDC6wFAmfn4WYACgkQHmWrcYGD C6z2lQv/QmFuQIknOpGKqlFPA9KORba/v5JR0Eu0buUZhO73r5Aedzusvtc4sTvX /HAEvKKZXa1BddSUDnjHRMehEVwNWWG7YazEBGqdPzb2SUgwra39+nUbdSKJfrAq /CxPYMGHf1qkFXW4VFADzMt/WNLgpcNpNTQk4CQOU8pUxw1PzkoMLRbsL3QlQ9zV 7Eb4oB8ju9hF+Vi5uYgExJf/5cRAc9MsCsb5YOija6fxgqPNnhSk9OIqq9FQMZRy lSWEx59H4y3KepOzNJJaiciHBFXiNQpyXQXcH5gsKeJsANF0Xzp2B0Ir9giH/yjU cHBwdUxfCX/td6uzbkj4Yo/wDT+bTT90P2QL1eYOu8JB/NqgrAoofvZb7sneEKnd ZtDX3Hu/RteZv3PGsbFLe7x7K7+3SwQfQ7zCoRdxz22YDrlCGUz4DX59SC9+b9vP WXsbsY3KTJFYt2Wmf6K+Xj+RM/HroOXhs5jrbS8TLkk90feHDCUc7jigxa9WTt4r WfpVICB2 =fxJC -----END PGP SIGNATURE----- Sys-CpuLoad-0.32/MANIFEST0000644000175000017500000000121714771760546012544 0ustar rrrr# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.032. Changes CpuLoad.xs INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README.md SECURITY.md SIGNATURE cpanfile dist.ini lib/Sys/CpuLoad.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/01-basic.t t/02-legacy.t t/10-getloadavg.t t/11-proc_loadavg.t t/12-uptime.t t/13-w.t t/20-load.t t/author-critic.t t/author-eof.t t/author-eol.t t/author-minimum-version.t t/author-no-tabs.t t/author-pod-coverage.t t/author-pod-linkcheck.t t/author-pod-syntax.t t/author-portability.t t/etc/perlcritic.rc t/release-fixme.t t/release-kwalitee.t t/release-trailing-space.t weaver.ini Sys-CpuLoad-0.32/t/0000775000175000017500000000000014771760546011657 5ustar rrrrSys-CpuLoad-0.32/t/author-no-tabs.t0000644000175000017500000000164014771760546014706 0ustar rrrr BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Sys/CpuLoad.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/01-basic.t', 't/02-legacy.t', 't/10-getloadavg.t', 't/11-proc_loadavg.t', 't/12-uptime.t', 't/13-w.t', 't/20-load.t', 't/author-critic.t', 't/author-eof.t', 't/author-eol.t', 't/author-minimum-version.t', 't/author-no-tabs.t', 't/author-pod-coverage.t', 't/author-pod-linkcheck.t', 't/author-pod-syntax.t', 't/author-portability.t', 't/etc/perlcritic.rc', 't/release-fixme.t', 't/release-kwalitee.t', 't/release-trailing-space.t' ); notabs_ok($_) foreach @files; done_testing; Sys-CpuLoad-0.32/t/author-critic.t0000644000175000017500000000041714771760546014621 0ustar rrrr#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::Perl::Critic (-profile => "t/etc/perlcritic.rc") x!! -e "t/etc/perlcritic.rc"; all_critic_ok(); Sys-CpuLoad-0.32/t/author-eol.t0000644000175000017500000000167214771760546014127 0ustar rrrr BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/Sys/CpuLoad.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/01-basic.t', 't/02-legacy.t', 't/10-getloadavg.t', 't/11-proc_loadavg.t', 't/12-uptime.t', 't/13-w.t', 't/20-load.t', 't/author-critic.t', 't/author-eof.t', 't/author-eol.t', 't/author-minimum-version.t', 't/author-no-tabs.t', 't/author-pod-coverage.t', 't/author-pod-linkcheck.t', 't/author-pod-syntax.t', 't/author-portability.t', 't/etc/perlcritic.rc', 't/release-fixme.t', 't/release-kwalitee.t', 't/release-trailing-space.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; Sys-CpuLoad-0.32/t/02-legacy.t0000644000175000017500000000036614771760546013532 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use Scalar::Util 'looks_like_number'; use Sys::CpuLoad (); my @load = Sys::CpuLoad::load(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/author-portability.t0000644000175000017500000000033214771760546015702 0ustar rrrr BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::More; use Test::Portability::Files; run_tests(); Sys-CpuLoad-0.32/t/00-report-prereqs.dd0000644000175000017500000000512314771760546015376 0ustar rrrrdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' }, 'suggests' => { 'JSON::PP' => '2.27300' } }, 'develop' => { 'requires' => { 'Pod::Coverage::TrustPod' => '0', 'Test::EOF' => '0', 'Test::EOL' => '0', 'Test::Kwalitee' => '1.21', 'Test::MinimumVersion' => '0', 'Test::More' => '0.88', 'Test::NoTabs' => '0', 'Test::Perl::Critic' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Pod::LinkCheck' => '0', 'Test::Portability::Files' => '0', 'Test::TrailingSpace' => '0.0203' } }, 'runtime' => { 'requires' => { 'Exporter' => '0', 'File::Which' => '0', 'IO::File' => '0', 'IPC::Run3' => '0', 'XSLoader' => '0', 'parent' => '0', 'perl' => 'v5.6.0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'File::Spec' => '0', 'Module::Metadata' => '0', 'Scalar::Util' => '0', 'Test::Deep' => '0', 'Test::Exception' => '0', 'Test::More' => '0', 'Test::Warnings' => '0' } } }; $x; }Sys-CpuLoad-0.32/t/release-kwalitee.t0000644000175000017500000000052714771760546015271 0ustar rrrr BEGIN { unless ($ENV{RELEASE_TESTING}) { print qq{1..0 # SKIP these tests are for release candidate testing\n}; exit } } # this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok( qw( -use_strict ) ); done_testing; Sys-CpuLoad-0.32/t/13-w.t0000644000175000017500000000063514771760546012535 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use File::Which qw/ which /; use Scalar::Util 'looks_like_number'; my $path = which("w"); plan skip_all => "no w found" unless $path && -x $path; use_ok 'Sys::CpuLoad', 'uptime'; no warnings 'once'; $Sys::CpuLoad::UPTIME = $path; my @load = uptime(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/release-trailing-space.t0000644000175000017500000000116314771760546016363 0ustar rrrr#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { print qq{1..0 # SKIP these tests are for release candidate testing\n}; exit } } use strict; use warnings; use Test::More; eval "use Test::TrailingSpace"; if ($@) { plan skip_all => "Test::TrailingSpace required for trailing space test."; } else { plan tests => 1; } # TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly # some other stuff. my $finder = Test::TrailingSpace->new( { root => '.', filename_regex => qr#\.(?:p[lm]|pod)\z#, }, ); # TEST $finder->no_trailing_space( "No trailing space was found." ); Sys-CpuLoad-0.32/t/01-basic.t0000644000175000017500000000036214771760546013342 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use Scalar::Util 'looks_like_number'; use_ok 'Sys::CpuLoad', 'load'; my @load = load(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/release-fixme.t0000644000175000017500000000040514771760546014567 0ustar rrrr#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { print qq{1..0 # SKIP these tests are for release candidate testing\n}; exit } } # This test is generated by Dist::Zilla::Plugin::Test::Fixme use strict; use warnings; use Test::Fixme; run_tests(); Sys-CpuLoad-0.32/t/etc/0000775000175000017500000000000014771760546012432 5ustar rrrrSys-CpuLoad-0.32/t/etc/perlcritic.rc0000644000175000017500000000011614771760546015114 0ustar rrrr[Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef] severity = 1 Sys-CpuLoad-0.32/t/author-pod-linkcheck.t0000644000175000017500000000074114771760546016057 0ustar rrrr#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } Sys-CpuLoad-0.32/t/author-pod-syntax.t0000644000175000017500000000045414771760546015453 0ustar rrrr#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Sys-CpuLoad-0.32/t/author-pod-coverage.t0000644000175000017500000000212214771760546015712 0ustar rrrr#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. use Test::Pod::Coverage 1.08; use Test::More 0.88; BEGIN { if ( $] <= 5.008008 ) { plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; } } use Pod::Coverage::TrustPod; my %skip = map { $_ => 1 } qw( ); my @modules; for my $module ( all_modules() ) { next if $skip{$module}; push @modules, $module; } plan skip_all => 'All the modules we found were excluded from POD coverage test.' unless @modules; plan tests => scalar @modules; my %trustme = (); my @also_private; for my $module ( sort @modules ) { pod_coverage_ok( $module, { coverage_class => 'Pod::Coverage::TrustPod', also_private => \@also_private, trustme => $trustme{$module} || [], }, "pod coverage for $module" ); } done_testing(); Sys-CpuLoad-0.32/t/author-eof.t0000644000175000017500000000064114771760546014114 0ustar rrrr BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::More; # Generated by Dist::Zilla::Plugin::Test::EOF 0.0600 eval "use Test::EOF"; plan skip_all => 'Test::EOF required to test for correct end of file flag' if $@; all_perl_files_ok({ minimum_newlines => 1, maximum_newlines => 4 }); done_testing(); Sys-CpuLoad-0.32/t/10-getloadavg.t0000644000175000017500000000103314771760546014372 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use Scalar::Util 'looks_like_number'; my $os = lc $^O; plan skip_all => $os if $os !~ /^(darwin|dragonfly|(free|net|open)bsd|linux|solaris|sunos)$/; use_ok 'Sys::CpuLoad', qw( getloadavg load ); my @load = getloadavg(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; no warnings 'once'; $Sys::CpuLoad::LOAD = 'getloadavg'; @load = load(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/author-minimum-version.t0000644000175000017500000000035614771760546016504 0ustar rrrr BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::More; use Test::MinimumVersion; all_minimum_version_from_metayml_ok(); Sys-CpuLoad-0.32/t/12-uptime.t0000644000175000017500000000102514771760546013563 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use File::Which qw/ which /; use Scalar::Util 'looks_like_number'; my $path = which("uptime"); plan skip_all => "no uptime found" unless $path && -x $path; use_ok 'Sys::CpuLoad', 'uptime', 'load'; my @load = uptime(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; no warnings 'once'; $Sys::CpuLoad::LOAD = 'uptime'; @load = load(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/00-report-prereqs.t0000644000175000017500000001362514771760546015260 0ustar rrrr#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029 use Test::More tests => 1; use Module::Metadata; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if grep { $_ eq $mod } @exclude; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; if ($mod eq 'perl') { push @reports, ['perl', $want, $]]; next; } my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; if ($prefix) { my $have = Module::Metadata->new_from_file( File::Spec->catfile($prefix, $file) )->version; $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Sys-CpuLoad-0.32/t/11-proc_loadavg.t0000644000175000017500000000075614771760546014731 0ustar rrrruse Test::More; use Test::Deep; use Test::Warnings; use Scalar::Util 'looks_like_number'; plan skip_all => "no /proc/loadavg" unless -r "/proc/loadavg"; use_ok 'Sys::CpuLoad', 'proc_loadavg', 'load'; my @load = proc_loadavg(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; no warnings 'once'; $Sys::CpuLoad::LOAD = 'proc_loadavg'; @load = load(); cmp_deeply \@load, [ (code(\&looks_like_number)) x 3 ], 'load'; diag "@load"; done_testing; Sys-CpuLoad-0.32/t/20-load.t0000644000175000017500000000033714771760546013203 0ustar rrrruse Test::More; use Test::Exception; use Test::Warnings; use Sys::CpuLoad qw/ load /; no warnings 'once'; $Sys::CpuLoad::LOAD = 'uptimr'; throws_ok { load() } qr/^Unknown function: uptimr /, 'load dies'; done_testing; Sys-CpuLoad-0.32/lib/0000775000175000017500000000000014771760546012162 5ustar rrrrSys-CpuLoad-0.32/lib/Sys/0000775000175000017500000000000014771760546012740 5ustar rrrrSys-CpuLoad-0.32/lib/Sys/CpuLoad.pm0000644000175000017500000001136514771760546014631 0ustar rrrrpackage Sys::CpuLoad; # ABSTRACT: retrieve system load averages # Copyright (c) 1999-2002 Clinton Wong. All rights reserved. # This program is free software; you can redistribute it # and/or modify it under the same terms as Perl itself. use v5.6; use strict; use warnings; use parent qw(Exporter); use File::Which qw(which); use IO::File; use IPC::Run3 qw(run3); use XSLoader; our @EXPORT = qw(); our @EXPORT_OK = qw(load getloadavg proc_loadavg uptime); our $VERSION = '0.32'; XSLoader::load 'Sys::CpuLoad', $VERSION; our $LOAD; sub load { return getloadavg(@_) if $LOAD eq 'getloadavg'; return proc_loadavg(@_) if $LOAD eq 'proc_loadavg'; return uptime(@_) if $LOAD eq 'uptime'; die "Unknown function: $LOAD"; } sub proc_loadavg { if ( -r '/proc/loadavg' ) { my $fh = IO::File->new( '/proc/loadavg', 'r' ); if ( defined $fh ) { my $line = <$fh>; $fh->close(); if ( $line =~ /^(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)/ ) { return ( $1, $2, $3 ); } } } return undef; } our $UPTIME; sub uptime { local %ENV = %ENV; $ENV{'LC_NUMERIC'} = 'POSIX'; # ensure that decimal separator is a dot $UPTIME ||= which("uptime") or return undef; run3($UPTIME, \undef, \my $line); return undef if $? || !defined($line); if ( $line =~ /(\d+[,.]\d+)\s*,?\s+(\d+[,.]\d+)\s*,?\s+(\d+[,.]\d+)\s*$/m ) { return ( map { my $n = $_; $n =~ tr/,/./; $n + 0 } ( $1, $2, $3 ) ); } return undef; } sub BEGIN { my $this = __PACKAGE__; my $os = lc $^O; if ( $os =~ /^(darwin|dragonfly|(free|net|open)bsd|linux|solaris|sunos)$/ ) { $LOAD = 'getloadavg'; } elsif ( -r '/proc/loadavg' && $os ne 'cygwin' ) { $LOAD = 'proc_loadavg'; } else { $LOAD = 'uptime'; } } 1; __END__ =pod =encoding UTF-8 =head1 NAME Sys::CpuLoad - retrieve system load averages =head1 VERSION version 0.32 =head1 SYNOPSIS use Sys::CpuLoad 'load'; print '1 min, 5 min, 15 min load average: ', join(',', load()), "\n"; =head1 DESCRIPTION This module retrieves the 1 minute, 5 minute, and 15 minute load average of a machine. =head1 EXPORTS =head2 load This method returns the load average for 1 minute, 5 minutes and 15 minutes as an array. On Linux, Solaris, FreeBSD, NetBSD and OpenBSD systems, it will make a call to L. If F is available on non-Cygwin systems, it will call L. Otherwise, it will attempt to parse the output of C. On error, it will return an array of C values. As of v0.29, you can override the default function by changing C<$Sys::CpuLoad::LOAD>: use Sys::CpuLoad 'load'; no warnings 'once'; $Sys::CpuLoad::LOAD = 'uptimr'; @load = load(); If you are writing code to work on multiple systems, you should use the C function. But if your code is intended for specific systems, then you should use the appropriate function. =head2 getloadavg This is a wrapper around the system call to C. If this call is unavailable, or it is fails, it will return C. Added in v0.22. =head2 proc_loadavg If F is available, it will be used. If the data cannot be parsed, it will return C. Added in v0.22. =head2 uptime Parse the output of uptime. If the L executable cannot be found, or the output cannot be parsed, it will return C. Added in v0.22. As of v0.24, you can override the executable path by setting C<$Sys::CpuLoad::UPTIME>, e.g. use Sys::CpuLoad 'uptime'; no warnings 'once'; $Sys::CpuLoad::UPTIME = '/usr/bin/w'; @load = uptime(); =head1 SEE ALSO L =head1 SOURCE The development version is on github at L and may be cloned from L =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHORS =over 4 =item * Robert Rothenberg =item * Clinton Wong =back =head1 CONTRIBUTORS =for stopwords Slaven Rezić Victor Wagner Dmitry Dorofeev Vincent Lefèvre =over 4 =item * Slaven Rezić =item * Victor Wagner =item * Dmitry Dorofeev =item * Vincent Lefèvre =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 1999-2002, 2020, 2025 by Clinton Wong . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Sys-CpuLoad-0.32/dist.ini0000644000175000017500000000440214771760546013056 0ustar rrrrname = Sys-CpuLoad author = Robert Rothenberg author = Clinton Wong license = Perl_5 copyright_holder = Clinton Wong copyright_year = 1999-2002, 2020, 2025 [Keywords] keyword = CPU keyword = load average keyword = loadavg keyword = system [Meta::Contributors] contributor = Slaven Rezić contributor = Victor Wagner contributor = Dmitry Dorofeev [GatherDir] exclude_match = cpanfile* [PruneCruft] [CPANFile] [License] ; [SecurityPolicy] ; -policy = Individual ; timeframe = one week [ExtraTests] [ExecDir] [ShareDir] [MakeMaker] [Manifest] [Signature] [TestRelease] [ConfirmRelease] [UploadToCPAN] [RecommendedPrereqs] [AutoPrereqs] [EnsurePrereqsInstalled] :version = 0.003 type = requires type = recommends [GitHub::Meta] repo = git://github.com/robrwo/Sys-CpuLoad.git [PodWeaver] [ReadmeAnyFromPod] type = gfm filename = README.md location = build [CopyFilesFromBuild] copy = README.md ; copy = SECURITY.md copy = cpanfile [ManifestSkip] [PruneFiles] match = ~$ match = \.c match = \.o match = \.obj match = \.bs [Metadata] x_authority = cpan:RRWO [MetaProvides::Package] [MetaJSON] [MetaYAML] [InstallGuide] [Prereqs / TestRequires ] ; authordep Pod::Weaver::Plugin::AppendPrepend ; authordep Pod::Weaver::Section::Contributors ; authordep Pod::Weaver::Section::SourceGitHub [PodSyntaxTests] ;; Seems broken for intermediate files in XS build [Test::CheckManifest] ;; N/A [Test::CleanNamespaces] [Test::EOF] [Test::EOL] :version = 0.14 [Test::Fixme] [Test::MinimumVersion] [Test::NoTabs] [Test::Perl::Critic] critic_config = t/etc/perlcritic.rc [Test::Pod::Coverage::Configurable] [Test::Pod::LinkCheck] [Test::Portability] ; authordep Test::TrailingSpace [Test::TrailingSpace] filename_regex = \.(?:p[lm]|pod)\z [Test::Kwalitee] skiptest = use_strict [Test::ReportPrereqs] :version = 0.022 version_extractor = Module::Metadata verify_prereqs = 1 [@Git] allow_dirty = dist.ini push_to = origin master:master tag_format = %v commit_msg = %v%n%n%c [Git::Contributors] :version = 0.019 [RewriteVersion] [NextRelease] [BumpVersionAfterRelease] [Git::Commit / Commit_Changes] ; commit Changes (for new dev) allow_dirty_match = ^lib/ commit_msg = Commit Changes and bump $VERSION Sys-CpuLoad-0.32/Changes0000644000175000017500000001103714771760546012707 0ustar rrrrRevision history for Perl extension Sys-CpuLoad: 0.32 2025-03-29 12:02:43+00:00 Europe/London [Documentation] - Added a security policy. - Updated copyright year. [Other] - Signed the release. 0.31 2020-07-31 14:23:19+01:00 Europe/London [Documentation] - Added missing line to Changes for v0.30. [Toolchain] - Add core modules in the prerequisites. 0.30 2020-04-06 08:14:52+01:00 Europe/London - No changes since v0.29. 0.29 2020-04-04 11:13:49+01:00 Europe/London (TRIAL RELEASE) [Enhancements] - Added support for changing the default load() function. [Documentation] - Added contributors names in Changes for earlier versions. [Tests] - Test for warnings. - Use Test::More and Test::Deep instead of Test::Most, due to global destruction warnings in latest Test::Most. [Other] - Rearrange POD to be interleaved with source code. 0.28 2020-04-02 17:35:22+01:00 Europe/London (TRIAL RELEASE) [Bug Fixes] - Fix how parsed values from uptime are numified for different locales. 0.27 2020-04-02 12:37:28+01:00 Europe/London (TRIAL RELEASE) [Bug Fixes] - Numify parsed values from uptime. [Tests] - Use locale-independent test that value is numeric. 0.26 2020-04-01 21:22:26+01:00 Europe/London (TRIAL RELEASE) [Bug Fixes] - Parse uptime output formatted with using different locales, thanks srezic. [Tests] - Fix skip_all to handle when no executable is found. - Fix comment on skip_all. [Other] - Add keywords to distribution metadata. 0.25 2020-03-30 23:30:00+01:00 Europe/London (TRIAL RELEASE) [Tests] - Check if uptime is executable. - Fix comment on t/13-w.t. 0.24 2020-03-30 12:25:45+01:00 Europe/London (TRIAL RELEASE) [Enhancements] - Use IPC::Run3 for uptime. - Add the ability to override the path of uptime. [Bug Fixes] - Check for uptime errors. [Other] - Move Perl::Critic exceptions into t/etc/perlcriticrc. 0.23 2020-03-29 13:09:50+01:00 Europe/London (TRIAL RELEASE) [Enhancements] - Support getloadavg for DragonFly BSD. - Change uptime to use backticks instead of piped open. [Bug Fixes] - uptime immediately returns undef if path to `uptime` cannot be found. [Tests] - Fixed test when skipping getloadavg test. - Skip uptime test if uptime cannot be found. 0.22 2020-03-27 12:51:39+00:00 Europe/London (TRIAL RELEASE) [Enhancements] - Split getloadavg, proc_loadavg and uptime into separate functions. - Use File::Which to locate uptime. [Incompatabilities] - Renamed _getbsdload to getloadavg. [Bug Fixes] - Accept uptime output without commas, RT#14034. [Tests] - Fix bug testing high loads. - Add tests for each function. 0.21 2020-03-25 13:03:11+00:00 Europe/London [Bug Fixes] - Actually use system getloadavg for NetBSD and Solaris. 0.20 2020-03-25 12:35:33+00:00 Europe/London [Enhancements] - Add support for NetBSD #2 and Solaris. - Return a single undef when the load function fails. [Bug Fixes] - The return value of getloadavg is now checked, #4. - The load method is set up in a BEGIN block instead of import, #5. [Documentation] - Update POD about changes in version 0.12. 0.12 2020-03-24 23:22:57+00:00 Europe/London [Enhancements] - Use getloadavg system call in Linux. - Port changes for Cygwin from Sys::CpuLoadX. [Tests] - Show diagnostics. 0.11 2020-03-24 22:57:02+00:00 Europe/London [Enhancements] - Added support for OS/X, thanks to Vincent Lefèvre, RT#14034/GH#3. 0.10 2020-03-24 22:41:56+00:00 Europe/London - Maintenance taken over by Robert Rothenberg. [Enhancements] - Modernised code style. - The load average method is determined during module import. - Use XSLoader instead of DynaLoader. [Bug Fixes] - Fixed VERSION. - Removed unnecessary use of AutoLoader. [Incompatabilities] - Minimum version is v5.6. - Renamed `getbsdload` to `_getbsdload`. [Documentation] - Reformatted Changes to conform to CPAN::Changes::Spec. [Tests] - Modernised the test, and added a test of the load function. [Other] - Reorganised files for modern CPAN distributions. - Distribution is minted with Dist::Zilla. 0.03 Mon Mar 18 15:02:33 PST 2002 - LC_NUMERIC patch from Victor Wagner - Added cache support to remember how we got the system load - Restricted getloadavg() to FreeBSD/OpenBSD for now 0.02 Sun Feb 17 23:43:26 PST 2002 - bsd getloadavg() support with help from Dmitry Dorofeev 0.01 Wed Aug 11 15:44:55 PDT 1999 - original version; created by h2xs 1.16 Sys-CpuLoad-0.32/weaver.ini0000644000175000017500000000046414771760546013410 0ustar rrrr[@CorePrep] [-SingleEncoding] ;; [-Transformer] ;; transformer = List [Name] [Version] [Region / prelude] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Collect / EXPORTS] command = export [Leftovers] [Region / postlude] [SourceGitHub] [Bugs] [Authors] [Contributors] [Legal] [-AppendPrepend] Sys-CpuLoad-0.32/INSTALL0000644000175000017500000000454414771760546012452 0ustar rrrrThis is the Perl distribution Sys-CpuLoad. Installing Sys-CpuLoad is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm Sys::CpuLoad If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Sys::CpuLoad ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/Sys::CpuLoad Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation Sys-CpuLoad documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc Sys::CpuLoad For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html Sys-CpuLoad-0.32/SECURITY.md0000644000175000017500000000730614771760546013211 0ustar rrrr# Security Policy for the Sys-CpuLoad distribution. This is the Security Policy for Sys-CpuLoad. Report issues via the project GitHub repository [Security Advisories](https://github.com/robrwo/Sys-CpuLoad/security/advisories). This text is based on the CPAN Security Group's Guidelines for Adding a Security Policy to Perl Distributions (version 1.0.0) https://security.metacpan.org/docs/guides/security-policy-for-authors.html # How to Report a Security Vulnerability Security vulnerabilities can be reported via the project GitHub repository [Security Advisories](https://github.com/robrwo/Sys-CpuLoad/security/advisories). Please include as many details as possible, including code samples or test cases, so that we can reproduce the issue. Check that your report does not expose any sensitive data, such as passwords, tokens, or personal information. If you would like any help with triaging the issue, or if the issue is being actively exploited, please copy the report to the CPAN Security Group (CPANSec) at . Please *do not* use the public issue reporting system on RT or GitHub issues for reporting security vulnerabilities. Please do not disclose the security vulnerability in public forums until past any proposed date for public disclosure, or it has been made public by the maintainers or CPANSec. That includes patches or pull requests. For more information, see [Report a Security Issue](https://security.metacpan.org/docs/report.html) on the CPANSec website. ## Response to Reports The maintainer(s) aim to acknowledge your security report as soon as possible. However, this project is maintained by a single person in their spare time, and they cannot guarantee a rapid response. If you have not received a response from them within one week, then please send a reminder to them and copy the report to CPANSec at . Please note that the initial response to your report will be an acknowledgement, with a possible query for more information. It will not necessarily include any fixes for the issue. The project maintainer(s) may forward this issue to the security contacts for other projects where we believe it is relevant. This may include embedded libraries, system libraries, prerequisite modules or downstream software that uses this software. They may also forward this issue to CPANSec. # Which Software This Policy Applies To Any security vulnerabilities in Sys-CpuLoad are covered by this policy. Security vulnerabilities are considered anything that allows users to execute unauthorised code, access unauthorised resources, or to have an adverse impact on accessibility or performance of a system. Security vulnerabilities in upstream software (embedded libraries, prerequisite modules or system libraries, or in Perl), are not covered by this policy unless they affect Sys-CpuLoad, or Sys-CpuLoad can be used to exploit vulnerabilities in them. Security vulnerabilities in downstream software (any software that uses Sys-CpuLoad, or plugins to it that are not included with the Sys-CpuLoad distribution) are not covered by this policy. ## Supported Versions of Sys-CpuLoad The maintainer(s) will only commit to releasing security fixes for the latest version of Sys-CpuLoad. # Installation and Usage Issues The distribution metadata specifies minimum versions of prerequisites that are required for Sys-CpuLoad to work. However, some of these prerequisites may have security vulnerabilities, and you should ensure that you are using up-to-date versions of these prerequisites. Where security vulnerabilities are known, the metadata may indicate newer versions as recommended. ## Usage Please see the software documentation for further information. Sys-CpuLoad-0.32/cpanfile0000644000175000017500000000256214771760546013123 0ustar rrrr# This file is generated by Dist::Zilla::Plugin::CPANFile v6.032 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. requires "Exporter" => "0"; requires "File::Which" => "0"; requires "IO::File" => "0"; requires "IPC::Run3" => "0"; requires "XSLoader" => "0"; requires "parent" => "0"; requires "perl" => "v5.6.0"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "File::Spec" => "0"; requires "Module::Metadata" => "0"; requires "Scalar::Util" => "0"; requires "Test::Deep" => "0"; requires "Test::Exception" => "0"; requires "Test::More" => "0"; requires "Test::Warnings" => "0"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; }; on 'configure' => sub { suggests "JSON::PP" => "2.27300"; }; on 'develop' => sub { requires "Pod::Coverage::TrustPod" => "0"; requires "Test::EOF" => "0"; requires "Test::EOL" => "0"; requires "Test::Kwalitee" => "1.21"; requires "Test::MinimumVersion" => "0"; requires "Test::More" => "0.88"; requires "Test::NoTabs" => "0"; requires "Test::Perl::Critic" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Pod::LinkCheck" => "0"; requires "Test::Portability::Files" => "0"; requires "Test::TrailingSpace" => "0.0203"; }; Sys-CpuLoad-0.32/README.md0000644000175000017500000000556114771760546012700 0ustar rrrr# NAME Sys::CpuLoad - retrieve system load averages # VERSION version 0.32 # SYNOPSIS ```perl use Sys::CpuLoad 'load'; print '1 min, 5 min, 15 min load average: ', join(',', load()), "\n"; ``` # DESCRIPTION This module retrieves the 1 minute, 5 minute, and 15 minute load average of a machine. # EXPORTS ## load This method returns the load average for 1 minute, 5 minutes and 15 minutes as an array. On Linux, Solaris, FreeBSD, NetBSD and OpenBSD systems, it will make a call to ["getloadavg"](#getloadavg). If `/proc/loadavg` is available on non-Cygwin systems, it will call ["proc\_loadavg"](#proc_loadavg). Otherwise, it will attempt to parse the output of `uptime`. On error, it will return an array of `undef` values. As of v0.29, you can override the default function by changing `$Sys::CpuLoad::LOAD`: ```perl use Sys::CpuLoad 'load'; no warnings 'once'; $Sys::CpuLoad::LOAD = 'uptimr'; @load = load(); ``` If you are writing code to work on multiple systems, you should use the `load` function. But if your code is intended for specific systems, then you should use the appropriate function. ## getloadavg This is a wrapper around the system call to `getloadavg`. If this call is unavailable, or it is fails, it will return `undef`. Added in v0.22. ## proc\_loadavg If `/proc/loadavg` is available, it will be used. If the data cannot be parsed, it will return `undef`. Added in v0.22. ## uptime Parse the output of uptime. If the [uptime](https://metacpan.org/pod/uptime) executable cannot be found, or the output cannot be parsed, it will return `undef`. Added in v0.22. As of v0.24, you can override the executable path by setting `$Sys::CpuLoad::UPTIME`, e.g. ```perl use Sys::CpuLoad 'uptime'; no warnings 'once'; $Sys::CpuLoad::UPTIME = '/usr/bin/w'; @load = uptime(); ``` # SEE ALSO [Sys::CpuLoadX](https://metacpan.org/pod/Sys%3A%3ACpuLoadX) # SOURCE The development version is on github at [https://github.com/robrwo/Sys-CpuLoad](https://github.com/robrwo/Sys-CpuLoad) and may be cloned from [git://github.com/robrwo/Sys-CpuLoad.git](git://github.com/robrwo/Sys-CpuLoad.git) # BUGS Please report any bugs or feature requests on the bugtracker website [https://github.com/robrwo/Sys-CpuLoad/issues](https://github.com/robrwo/Sys-CpuLoad/issues) When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. # AUTHORS - Robert Rothenberg - Clinton Wong # CONTRIBUTORS - Slaven Rezić - Victor Wagner - Dmitry Dorofeev - Vincent Lefèvre # COPYRIGHT AND LICENSE This software is copyright (c) 1999-2002, 2020, 2025 by Clinton Wong . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Sys-CpuLoad-0.32/META.yml0000644000175000017500000000252214771760546012664 0ustar rrrr--- abstract: 'retrieve system load averages' author: - 'Robert Rothenberg ' - 'Clinton Wong ' build_requires: File::Spec: '0' Module::Metadata: '0' Scalar::Util: '0' Test::Deep: '0' Test::Exception: '0' Test::More: '0' Test::Warnings: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010' keywords: - CPU - load - average - loadavg - system license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Sys-CpuLoad provides: Sys::CpuLoad: file: lib/Sys/CpuLoad.pm version: '0.32' requires: Exporter: '0' File::Which: '0' IO::File: '0' IPC::Run3: '0' XSLoader: '0' parent: '0' perl: v5.6.0 strict: '0' warnings: '0' resources: bugtracker: https://github.com/robrwo/Sys-CpuLoad/issues homepage: https://metacpan.org/release/Sys-CpuLoad repository: git://github.com/robrwo/Sys-CpuLoad.git version: '0.32' x_authority: cpan:RRWO x_contributors: - 'Slaven Rezić ' - 'Victor Wagner' - 'Dmitry Dorofeev ' - 'Vincent Lefèvre ' x_generated_by_perl: v5.34.3 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Sys-CpuLoad-0.32/Makefile.PL0000644000175000017500000000315314771760546013366 0ustar rrrr# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.032. use strict; use warnings; use 5.006000; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "retrieve system load averages", "AUTHOR" => "Robert Rothenberg , Clinton Wong ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Sys-CpuLoad", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006000", "NAME" => "Sys::CpuLoad", "PREREQ_PM" => { "Exporter" => 0, "File::Which" => 0, "IO::File" => 0, "IPC::Run3" => 0, "XSLoader" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "Module::Metadata" => 0, "Scalar::Util" => 0, "Test::Deep" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Warnings" => 0 }, "VERSION" => "0.32", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => 0, "File::Spec" => 0, "File::Which" => 0, "IO::File" => 0, "IPC::Run3" => 0, "Module::Metadata" => 0, "Scalar::Util" => 0, "Test::Deep" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Warnings" => 0, "XSLoader" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Sys-CpuLoad-0.32/CpuLoad.xs0000644000175000017500000000141514771760546013316 0ustar rrrr#ifdef __cplusplus extern "C" { #endif #include #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif MODULE = Sys::CpuLoad PACKAGE = Sys::CpuLoad void getloadavg() PREINIT: double loadavg[3]; int nelem; PPCODE: #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__linux__) || defined(__sun) || defined(__DragonFly__) nelem = getloadavg(loadavg, 3); #else nelem = -1; #endif if (nelem != -1) { EXTEND(SP, 3); PUSHs(sv_2mortal(newSVnv(loadavg[0]))); PUSHs(sv_2mortal(newSVnv(loadavg[1]))); PUSHs(sv_2mortal(newSVnv(loadavg[2]))); } else { XSRETURN_UNDEF; } Sys-CpuLoad-0.32/LICENSE0000644000175000017500000004660314771760546012430 0ustar rrrrThis software is copyright (c) 1999-2002, 2020, 2025 by Clinton Wong . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 1999-2002, 2020, 2025 by Clinton Wong . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 1999-2002, 2020, 2025 by Clinton Wong . This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End