]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/ProcFSTools.pm
PBS client: backup tree: avoid over generic param has
[pve-common.git] / src / PVE / ProcFSTools.pm
index 7cf14721c2f2bb872ae41ae301a3d6a095826c26..7687c13c4e30b9d483ebb624c8d522ca8a74ca3d 100644 (file)
@@ -132,6 +132,24 @@ sub read_loadavg {
     return wantarray ? (0, 0, 0) : 0;
 }
 
+sub read_pressure {
+
+    my $res = {};
+    foreach my $type (qw(cpu memory io)) {
+       if (my $fh = IO::File->new ("/proc/pressure/$type", "r")) {
+           while (defined (my $line = <$fh>)) {
+               if ($line =~ /^(some|full)\s+avg10\=(\d+\.\d+)\s+avg60\=(\d+\.\d+)\s+avg300\=(\d+\.\d+)\s+total\=(\d+)/) {
+                   $res->{$type}->{$1}->{avg10} = $2;
+                   $res->{$type}->{$1}->{avg60} = $3;
+                   $res->{$type}->{$1}->{avg300} = $4;
+               }
+           }
+           $fh->close;
+       }
+    }
+    return $res;
+}
+
 my $last_proc_stat;
 
 sub read_proc_stat {