1PERFMONCTL(2)                 Linux System Calls                 PERFMONCTL(2)
2
3
4

NAME

6       perfmonctl - interface to PMU
7

SYNOPSIS

9       #include <syscall.h>
10       #include <perfmon.h>
11
12       long perfmonctl(int fd, int cmd, void *arg, int narg);
13

DESCRIPTION

15       perfmonctl  system call provides an interface to PMU (performance moni‐
16       toring unit).  PMU consists of PMD (performance monitoring data) regis‐
17       ters  and  PMC  (performance  monitoring  control) registers, where are
18       gathered the hardware statistic.
19
20       perfmonctl will apply a function cmd to input arguments arg.  The  num‐
21       ber  of  arguments is defined by input variable narg.  fd specifies the
22       perfmon context to operate on.
23
24       The implemented commands cmd are:
25
26
27       PFM_CREATE_CONTEXT
28              set up a context
29              perfmonctl(int fd, PFM_CREATE_CONTEXT , pfarg_context_t *ctxt, 1);
30
31              The fd parameter is ignored.  A new context is created as speci‐
32              fied   in   ctxt   and   its  file  descriptor  is  returned  in
33              ctxt->ctx_fd.
34
35              The file descriptor, apart from passing it to perfmonctl, can be
36              used  to  read  event  notifications  (type pfm_msg_t) using the
37              read(2) system call.  Both select(2) and poll(2) can be used  to
38              wait for event notifications.
39
40              The context can be destroyed using the close(2) system call.
41
42       PFM_WRITE_PMCS
43              set PMC registers
44              perfmonctl(int fd, PFM_WRITE_PMCS , pfarg_pmc_t *pmcs, n);
45
46       PFM_WRITE_PMDS
47              set PMD registers
48              perfmonctl(int fd, PFM_WRITE_PMDS , pfarg_pmd_t *pmds, n);
49
50       PFM_READ_PMDS
51              read PMD registers
52              perfmonctl(int fd, PFM_READ_PMDS , pfarg_pmd_t *pmds, n);
53
54       PFM_START
55              start monitoring
56              perfmonctl(int fd, PFM_START , arg , 1);
57              perfmonctl(int fd, PFM_START , NULL , 0);
58
59       PFM_STOP
60              stop monitoring
61              perfmonctl(int fd, PFM_START , NULL , 0);
62
63       PFM_LOAD_CONTEXT
64              attach the context to a thread
65              perfmonctl(int fd, PFM_LOAD_CONTEXT ,pfarg_load_t *largs,1);
66
67       PFM_UNLOAD_CONTEXT
68              detach the context from a thread
69              perfmonctl(int fd, PFM_UNLOAD_CONTEXT , NULL , 0);
70
71       PFM_RESTART
72              restart monitoring after recieving an overflow notification
73              perfmonctl(int fd, PFM_RESTART , NULL , 0);
74
75       PFM_CREATE_EVTSETS
76              create or modify event sets
77              perfmonctl(int fd, PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
78
79       PFM_DELETE_EVTSETS
80              delete event sets
81              perfmonctl(int fd, PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
82
83       PFM_GETINFO_EVTSETS
84              get information about event sets
85              perfmonctl(int fd, PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
86
87

RETURN VALUE

89       performctl  returns zero when the operation is successful.  On error -1
90       is returned and an error code is set in errno.
91
92

AVAILABILITY

94       This syscall is implemented only on the IA-64 architecture since kernel
95       2.6.
96
97

SEE ALSO

99       gprof(1), The perfmon2 interface specification
100
101
102
103Linux                           28 August 2006                   PERFMONCTL(2)
Impressum