linux stop函数,perfmonctl()函数 Unix/Linux

perfmonctl -接口PMU

内容简介

#include

#include

long perfmonctl(intfd, intcmd, void *arg, intnarg);

描述

perfmonctlsystem call provides an interface to PMU (performance monitoring unit). PMU consists of PMD (performance monitoring data) registers and PMC (performance monitoring control) registers, where are gathered the hardware statistic.

perfmonctl will apply a function cmd to input arguments arg. The number of arguments is defined by input variable narg. fd specifies the perfmon context to operate on.

实现的 cmd命令是:

标签

描述

PFM_CREATE_CONTEXT

set up a context

perfmonctl(intfd, PFM_CREATE_CONTEXT , pfarg_context_t *ctxt,1);

The fd parameter is ignored. A new context is created as specified in ctxtand its file descriptor is returned in ctxt->ctx_fd.

The file descriptor, apart from passing it to perfmonctl, can be used to read event notifications (type pfm_msg_t) using the read(2) system call. Both select(2) and poll(2) can be used to wait for event notifications.

The context can be destroyed using the close(2) system call.

PFM_WRITE_PMCS

set PMC registers

perfmonctl(intfd, PFM_WRITE_PMCS , pfarg_pmc_t *pmcs,n);

PFM_WRITE_PMDS

set PMD registers

perfmonctl(intfd, PFM_WRITE_PMDS , pfarg_pmd_t *pmds,n);

PFM_READ_PMDS

read PMD registers

perfmonctl(intfd, PFM_READ_PMDS , pfarg_pmd_t *pmds,n);

PFM_START

start monitoring

perfmonctl(intfd,PFM_START,arg,1);

perfmonctl(intfd,PFM_START,NULL,0);

PFM_STOP

stop monitoring

perfmonctl(intfd,PFM_START,NULL,0);

PFM_LOAD_CONTEXT

attach the context to a thread

perfmonctl(intfd, PFM_LOAD_CONTEXT ,pfarg_load_t *largs,1);

PFM_UNLOAD_CONTEXT

detach the context from a thread

perfmonctl(intfd,PFM_UNLOAD_CONTEXT,NULL,0);

PFM_RESTART

restart monitoring after recieving an overflow notification

perfmonctl(intfd,PFM_RESTART,NULL,0);

PFM_CREATE_EVTSETS

create or modify event sets

perfmonctl(intfd,PFM_CREATE_EVTSETS,pfarg_setdesc_t*desc,n);

PFM_DELETE_EVTSETS

delete event sets

perfmonctl(intfd,PFM_DELETE_EVTSET,pfarg_setdesc_t*desc,n);

PFM_GETINFO_EVTSETS

get information about event sets

perfmonctl(intfd,PFM_GETINFO_EVTSETS,pfarg_setinfo_t*info,n);

返回值

performctlreturns zero when the operation is successful. On error -1 is returned and an error code is set inerrno.

可用性

This syscall is implemented only on the IA-64 architecture since kernel 2.6.

另请参阅

¥ 我要打赏

纠错/补充

收藏

加QQ群啦,易百教程官方技术学习群

注意:建议每个人选自己的技术方向加群,同一个QQ最多限加 3 个群。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值