Skip to content

Commit

Permalink
[backend] collect also memory usage data from vm builds
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Oct 15, 2012
1 parent f691618 commit 1bdf4d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,13 @@ our $buildstatistics = [
'buildstatistics' =>
[ 'disk' =>
[],
'max_storage_usage',
'max_usage',
'io_requests',
'io_sectors',
],
[ 'memory' =>
'max_usage',
],
# 'cpu' =>
];

Expand Down
12 changes: 5 additions & 7 deletions src/backend/bs_worker
Original file line number Diff line number Diff line change
Expand Up @@ -2068,23 +2068,21 @@ sub dobuild {
# convert build statistics into xml
if( -e "$buildroot/.build.packages/_statistics") {
my $stats = {};
my $disk = {};
my $iosectors = 0;
my $iorequests = 0;
open(FILE, "<", "$buildroot/.build.packages/_statistics") || die;
while(<FILE>) {
my ($key, $value) = split( ": ", $_ );
if ($key eq "MAX_mb_used_on_disk" ){
$disk->{'max_storage_usage'} = $value;
$stats->{'disk'} = $disk;
$stats->{'disk'}->{'max_usage'} = $value;
} elsif ($key eq "MAX_mb_used_memory" ){
$stats->{'memory'}->{'max_usage'} = $value;
} elsif ($key eq "IO_requests_read" || $key eq "IO_requests_write" ){
$iorequests += $value;
$disk->{'io_requests'} = $iorequests;
$stats->{'disk'} = $disk;
$stats->{'disk'}->{'io_requests'} = $iorequests;
} elsif ($key eq "IO_sectors_read" || $key eq "IO_sectors_write" ){
$iosectors += $value;
$disk->{'io_sectors'} = $iosectors;
$stats->{'disk'} = $disk;
$stats->{'disk'}->{'io_sectors'} = $iosectors;
}
}
close FILE;
Expand Down

0 comments on commit 1bdf4d6

Please sign in to comment.