line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Sys::Load; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
15528
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
123
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
require DynaLoader; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter DynaLoader); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw( getload uptime ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
bootstrap Sys::Load $VERSION; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Preloaded methods go here. |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use constant UPTIME => "/proc/uptime"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
174
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub uptime { |
24
|
0
|
0
|
|
0
|
0
|
|
open(FILE, UPTIME) || return 0; |
25
|
0
|
|
|
|
|
|
my $line = ; |
26
|
0
|
|
|
|
|
|
my($uptime, $idle) = split /\s+/, $line; |
27
|
0
|
|
|
|
|
|
close FILE; |
28
|
0
|
|
|
|
|
|
return $uptime; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |