|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/bin/ |
Upload File : |
#!/usr/bin/perl
# Print numa statistics for all nodes
# Copyright (C) 2003,2004 Andi Kleen, SuSE Labs.
#
# numastat is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; version
# 2.
#
# numastat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should find a copy of v2 of the GNU General Public License somewhere
# on your Linux system; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
if (! -d "/sys/devices/system/node" ) {
print STDERR "sysfs not mounted or system not NUMA aware\n";
exit 1;
}
%stat = ();
$title = "\t\t";
opendir(NODES, "/sys/devices/system/node") || exit 1;
foreach $nd (readdir(NODES)) {
next unless $nd =~ /node(\d+)/;
open(STAT, "/sys/devices/system/node/$nd/numastat") ||
die "cannot open $nd: $!\n";
$title .= sprintf("%14s",$nd);
@fields = ();
while (<STAT>) {
($name, $val) = split;
$stat{$name} .= sprintf("%14u", $val);
push(@fields, $name);
}
close STAT;
}
closedir NODES;
print "$title\n";
foreach (@fields) {
print "$_\t$stat{$_}\n";
}