Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display improvements in mogstats #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions mogstats
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/perl

eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# vim:ts=4 sw=4 ft=perl et:
# TODO:
# YAML display mode
Expand Down Expand Up @@ -215,21 +218,21 @@ sub cmd_stats {

if ($args{files} || $args{all}) {
print "\nStatistics for files...\n";
printf " %-20s %-10s %10s %11s %13s\n", 'domain', 'class', 'files',
printf " %-20s %-20s %10s %11s %13s\n", 'domain', 'class', 'files',
'size (m)', 'fullsize (m)';
printf " -------------------- ----------- ---------- ----------- -------------\n";
printf " -------------------- -------------------- ---------- ----------- -------------\n";
foreach my $domain (sort keys %{$stats->{files}}) {
my $classes = $stats->{files}->{$domain};
foreach my $class (sort keys %$classes) {
my $stat = $classes->{$class};
my $files = $stat->[2];
my $size = int($stat->[3] / 1024 / 1024);
my $total = int($stat->[4] / 1024 / 1024);
printf " %-20s %-10s %10s %11s %13s\n", $domain, $class,
printf " %-20s %-20s %10s %11s %13s\n", $domain, $class,
$files, $size, $total;
}
}
printf " -------------------- ----------- ---------- ----------- -------------\n";
printf " -------------------- -------------------- ---------- ----------- -------------\n";
}

if ($args{domains} && !($args{files} || $args{all})) {
Expand All @@ -248,19 +251,19 @@ sub cmd_stats {

if ($args{replication} || $args{all}) {
print "\nStatistics for replication...\n";
printf " %-20s %-10s %10s %10s\n", 'domain', 'class', 'devcount', 'files';
printf " -------------------- ----------- ---------- ----------\n";
printf " %-20s %-20s %10s %10s\n", 'domain', 'class', 'devcount', 'files';
printf " -------------------- -------------------- ---------- ----------\n";
foreach my $domain (sort keys %{$stats->{replication}}) {
my $classes = $stats->{replication}->{$domain};
foreach my $class (sort keys %$classes) {
my $devcounts = $classes->{$class};
foreach my $devcount (sort { $a <=> $b } keys %$devcounts) {
my $files = $devcounts->{$devcount};
printf " %-20s %-10s %10s %10s\n", $domain, $class, $devcount, $files;
printf " %-20s %-20s %10s %10s\n", $domain, $class, $devcount, $files;
}
}
}
printf " -------------------- ----------- ---------- ----------\n";
printf " -------------------- -------------------- ---------- ----------\n";
}
# Now new stats.
if ($args{'replication-queue'} || $args{all}) {
Expand Down