summaryrefslogtreecommitdiff
path: root/cpupload.pl
diff options
context:
space:
mode:
Diffstat (limited to 'cpupload.pl')
-rwxr-xr-xcpupload.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/cpupload.pl b/cpupload.pl
new file mode 100755
index 0000000..a490a89
--- /dev/null
+++ b/cpupload.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+# cpuload.pl 2010 (c) Paul Buetow
+
+use strict;
+use warnings;
+
+sub say (@) {
+ print "$_\n" for @_;
+ return scalar @_;
+}
+
+sub reduce (&@) {
+
+}
+
+sub parse_stat_line ($) {
+ my %load;
+ my ($name, $user, $nice, $system, $idle, @rest) = split / +/, shift;
+ my $total = $user + $nice + $system + $idle;
+ print $nice, "\n";
+
+ return undef;
+}
+
+sub parse_stat (@) {
+ my ($total,@rest) = @_;
+
+ parse_stat_line $total;
+
+ return undef;
+}
+
+sub get_local_stat () {
+ open my $fh, '/proc/stat' or die "$!: /proc/stat\n";
+ my @stat = <$fh>;
+ close $fh;
+
+ return @stat;
+}
+
+sub main () {
+ parse_stat get_local_stat;
+
+ exit 0;
+}
+
+main;
+
+