blib/lib/Sys/Load.pm

filter: Statementstmt 78.2% 18 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 70.9% 22 / 31 CC 2 SCAR 9.8
CC
2
Cov
72%
uptime
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary Load.xs »
1  
2 package Sys::Load;
3  
4 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Exporter;
9 1 require DynaLoader;
10  
11 1 our @ISA = qw(Exporter DynaLoader);
12  
13 1 our @EXPORT_OK = qw( getload uptime );
14  
15 1 our $VERSION = '0.2';
16  
17 1 bootstrap Sys::Load $VERSION;
18  
19 # Preloaded methods go here.
20  
21 1 ▶use constant UPTIME => "/proc/uptime";
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 0 ▶sub uptime {
Subroutine uptime: not called CC=2 SCAR=17.9
Pod undocumented
24 0 ▶ open(FILE, UPTIME) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
open FILE, "/proc/uptime" or return 0 0 0 0
25 0 my $line = <FILE>;
26 0 my($uptime, $idle) = split /\s+/, $line;
27 0 close FILE;
28 0 return $uptime;
29 }
30  
31 1 1;
32  
33 __END__
↑ Summary Load.xs »