| 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
| |||||||||||
| 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__ | ||||||||||