added the max() function

This commit is contained in:
Jordi Sanfeliu 2013-01-28 13:18:03 +01:00
parent e815393761
commit 62ba877427
1 changed files with 9 additions and 1 deletions

View File

@ -23,7 +23,7 @@ package Monitorix;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT = qw(logger trim get_nvidia_data flush_accounting_rules);
our @EXPORT = qw(logger trim max get_nvidia_data flush_accounting_rules);
sub logger {
my ($msg) = @_;
@ -42,6 +42,14 @@ sub trim {
}
}
sub max {
my ($max, @args) = @_;
foreach (@args) {
$max = $_ if $_ > $max;
}
return $max;
}
sub get_nvidia_data {
my ($gpu) = @_;
my $total = 0;