1
diff -ruN numactl-2.0.8-rc5.orig/numastat numactl-2.0.8-rc5.new/numastat
2
--- numactl-2.0.8-rc5.orig/numastat 2012-08-23 15:50:37.000000000 -0400
3
+++ numactl-2.0.8-rc5.new/numastat 1969-12-31 19:00:00.000000000 -0500
6
-# Print numa statistics for all nodes
7
-# Copyright (C) 2003,2004 Andi Kleen, SuSE Labs.
9
-# numastat is free software; you can redistribute it and/or
10
-# modify it under the terms of the GNU General Public
11
-# License as published by the Free Software Foundation; version
14
-# numastat is distributed in the hope that it will be useful,
15
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
-# General Public License for more details.
19
-# You should find a copy of v2 of the GNU General Public License somewhere
20
-# on your Linux system; if not, write to the Free Software Foundation,
21
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
23
-# Example: NUMASTAT_WIDTH=80 watch -n1 numastat
28
-if (defined($ENV{'NUMASTAT_WIDTH'})) {
29
- $WIDTH=$ENV{'NUMASTAT_WIDTH'};
32
- if (POSIX::isatty(fileno(STDOUT))) {
33
- if (open(R, "resize |")) {
35
- $WIDTH=$1 if /COLUMNS=(\d+)/;
40
- # don't split it up for easier parsing
44
-$WIDTH = 32 if $WIDTH < 32;
46
-if (! -d "/sys/devices/system/node" ) {
47
- print STDERR "sysfs not mounted or system not NUMA aware\n";
54
-opendir(NODES, "/sys/devices/system/node") || exit 1;
55
-foreach $nd (readdir(NODES)) {
56
- next unless $nd =~ /node(\d+)/;
57
- # On newer kernels, readdir may enumerate the 'node(\d+) subdirs
58
- # in opposite order from older kernels--e.g., node{0,1,2,...}
59
- # as opposed to node{N,N-1,N-2,...}. Accomodate this by
60
- # switching to new mode so that the stats get emitted in
62
- #print "readdir(NODES) returns $nd\n";
63
- if (!$title && $nd =~ /node0/) {
66
- open(STAT, "/sys/devices/system/node/$nd/numastat") ||
67
- die "cannot open $nd: $!\n";
69
- $title = sprintf("%16s",$nd) . $title;
71
- $title = $title . sprintf("%16s",$nd);
75
- ($name, $val) = split;
77
- $stat{$name} = sprintf("%16u", $val) . $stat{$name};
79
- $stat{$name} = $stat{$name} . sprintf("%16u", $val);
81
- push(@fields, $name);
87
-$numfields = int(($WIDTH - 16) / 16);
88
-$l = 16 * $numfields;
89
-for ($i = 0; $i < length($title); $i += $l) {
90
- print "\n" if $i > 0;
91
- printf "%16s%s\n","",substr($title,$i,$l);
93
- printf "%-16s%s\n",$_,substr($stat{$_},$i,$l);