]> granicus.if.org Git - procps-ng/commitdiff
ps: have now added the NUMA node field display support
authorJim Warner <james.warner@comcast.net>
Sat, 13 May 2017 05:04:00 +0000 (00:04 -0500)
committerCraig Small <csmall@enc.com.au>
Mon, 22 May 2017 11:34:32 +0000 (21:34 +1000)
[ this patch has been adapted from the newlib branch ]

Reference(s):
https://gitlab.com/procps-ng/procps/issues/58

Signed-off-by: Jim Warner <james.warner@comcast.net>
ps/output.c
ps/ps.1

index f9a29bf6ff46358d61029eea5b0bbb15dfeae504..82384eac7504d0edc8759575d8cf2e2a95d4b461 100644 (file)
@@ -70,6 +70,7 @@
 #include "../proc/procps.h"
 #include "../proc/devname.h"
 #include "../proc/escape.h"
+#include "../proc/numa.h"
 
 #include "common.h"
 
@@ -975,6 +976,12 @@ static int pr_psr(char *restrict const outbuf, const proc_t *restrict const pp){
   return snprintf(outbuf, COLWID, "%d", pp->processor);
 }
 
+static int pr_numa(char *restrict const outbuf, const proc_t *restrict const pp){
+  static int first = 1;
+  if (first) { numa_init(); first = 0; }   // we'll keep this dependency local
+  return snprintf(outbuf, COLWID, "%d", numa_node_of_cpu(pp->processor));
+}
+
 static int pr_rss(char *restrict const outbuf, const proc_t *restrict const pp){
   return snprintf(outbuf, COLWID, "%lu", pp->vm_rss);
 }
@@ -1545,6 +1552,7 @@ static const format_struct format_array[] = {
 {"nsignals",  "NSIGS",   pr_nop,      sr_nop,     5,   0,    DEC, AN|RIGHT}, /*nsigs*/
 {"nsigs",     "NSIGS",   pr_nop,      sr_nop,     5,   0,    BSD, AN|RIGHT}, /*nsignals*/
 {"nswap",     "NSWAP",   pr_nop,      sr_nop,     5,   0,    XXX, AN|RIGHT},
+{"numa",      "NUMA",    pr_numa,     sr_nop,     4,   0,    XXX, AN|RIGHT},
 {"nvcsw",     "VCSW",    pr_nop,      sr_nop,     5,   0,    XXX, AN|RIGHT},
 {"nwchan",    "WCHAN",   pr_nwchan,   sr_nop,     6,   0,    XXX, TO|RIGHT},
 {"opri",      "PRI",     pr_opri,     sr_priority, 3,  0,    SUN, TO|RIGHT},
diff --git a/ps/ps.1 b/ps/ps.1
index cbe367f951266b5d6f5272339718dfba5d1e5bf7..89463b289129f547a0cddb68c6869e74abefd8da 100644 (file)
--- a/ps/ps.1
+++ b/ps/ps.1
@@ -4,7 +4,7 @@
 .\" Quick hack conversion by Albert Cahalan, 1998.
 .\" Licensed under version 2 of the Gnu General Public License.
 .\"
-.TH PS 1 "August 2015" "procps-ng" "User Commands"
+.TH PS 1 "May 2017" "procps-ng" "User Commands"
 .\"
 .\" To render this page:
 .\"    groff -t -b -man -X -P-resolution -P100 -Tps ps.1 &
@@ -1379,6 +1379,11 @@ number of lwps (threads) in the process.  (alias
 .BR thcount ).
 T}
 
+numa   NUMA    T{
+The node assocated with the most recently used processor.
+A -1 means that NUMA information is unavailable.
+T}
+
 nwchan WCHAN   T{
 address of the kernel function where the process is sleeping (use
 .B wchan