package Proc::Loadavg;

use strict;
use warnings;

#use Exporter;

#our @ISA = qw(Exporter);
#our @EXPORT = qw(loadavg);


sub loadavg {

	open( LOADAVG, '/proc/loadavg' ) || die "Can't open /proc/loadavg: $!";
	my $line = <LOADAVG>;
	close( LOADAVG );

	if( $line =~ /^(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)/ ) {
		return ($1, $2, $3);
	}
	else {
		die "Illegal format of /proc/loadavg content: $line!";
	}
}


1;
