linux打印指针地址吗,我可以从指针地址(在Linux上的C中)获取NUMA节点吗?

在-lnuma中有一个move_pages函数:

http://linux.die.net/man/2/move_pages

它可以向节点映射报告当前的地址状态(页面):

nodes can also be NULL, in which case move_pages() does not move any pages but instead will return the node where each page currently resides, in the status array. Obtaining the status of each page may be necessary to determine pages that need to be moved.

所以,电话可能是这样的:

void * ptr_to_check = your_address;

/*here you should align ptr_to_check to page boundary */

int status[1];

int ret_code;

status[0]=-1;

ret_code=move_pages(0 /*self memory */, 1, &ptr_to_check,

NULL, status, 0);

printf("Memory at %p is at %d node (retcode %d)\n", ptr_to_check, status[0], ret_code);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值