summaryrefslogtreecommitdiffstats
path: root/tapset/memory.stp
diff options
context:
space:
mode:
authorguanglei <guanglei>2006-07-04 03:57:49 +0000
committerguanglei <guanglei>2006-07-04 03:57:49 +0000
commit6b6427637595a0386674a51c65449f3004115a91 (patch)
tree7c982bd7443ca111c0c6a0af3ad268b716c7c0f5 /tapset/memory.stp
parentae0025b3661fafdddfe0a24695f385accc7c2cbf (diff)
downloadsystemtap-steved-6b6427637595a0386674a51c65449f3004115a91.tar.gz
systemtap-steved-6b6427637595a0386674a51c65449f3004115a91.tar.xz
systemtap-steved-6b6427637595a0386674a51c65449f3004115a91.zip
add addr_to_node() from Jose Santos
Diffstat (limited to 'tapset/memory.stp')
-rw-r--r--tapset/memory.stp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tapset/memory.stp b/tapset/memory.stp
index 9289ae5e..2682b5a7 100644
--- a/tapset/memory.stp
+++ b/tapset/memory.stp
@@ -14,3 +14,19 @@ probe pagefault
write_access = $write_access
address = $address
}
+
+/* Return which node the given address belongs to in a NUMA system */
+function addr_to_node:long(addr:long) /* pure */
+%{
+ int nid;
+ int pfn = __pa(THIS->addr) >> PAGE_SHIFT;
+ for_each_online_node(nid)
+ if ( node_start_pfn(nid) <= pfn &&
+ pfn < (node_start_pfn(nid) +
+ NODE_DATA(nid)->node_spanned_pages) )
+ {
+ THIS->__retvalue = nid;
+ break;
+ }
+
+%}