1PERFMONCTL(2) Linux Programmer's Manual PERFMONCTL(2)
2
3
4
6 perfmonctl - interface to IA-64 performance monitoring unit
7
9 #include <syscall.h>
10 #include <perfmon.h>
11
12 long perfmonctl(int fd, int cmd, void *arg, int narg);
13
14 Note: There is no glibc wrapper for this system call; see NOTES.
15
17 The IA-64-specific perfmonctl() system call provides an interface to
18 the PMU (performance monitoring unit). The PMU consists of PMD (per‐
19 formance monitoring data) registers and PMC (performance monitoring
20 control) registers, which gather hardware statistics.
21
22 perfmonctl() applies the operation cmd to the input arguments specified
23 by arg. The number of arguments is defined by narg. The fd argument
24 specifies the perfmon context to operate on.
25
26 Supported values for cmd are:
27
28 PFM_CREATE_CONTEXT
29 perfmonctl(int fd, PFM_CREATE_CONTEXT, pfarg_context_t *ctxt, 1);
30 Set up a context.
31
32 The fd parameter is ignored. A new perfmon context is created
33 as specified in ctxt and its file descriptor is returned in
34 ctxt->ctx_fd.
35
36 The file descriptor can be used in subsequent calls to perf‐
37 monctl() and can be used to read event notifications (type
38 pfm_msg_t) using read(2). The file descriptor is pollable using
39 select(2), poll(2), and epoll(7).
40
41 The context can be destroyed by calling close(2) on the file de‐
42 scriptor.
43
44 PFM_WRITE_PMCS
45 perfmonctl(int fd, PFM_WRITE_PMCS, pfarg_reg_t *pmcs, n);
46 Set PMC registers.
47
48 PFM_WRITE_PMDS
49 perfmonctl(int fd, PFM_WRITE_PMDS, pfarg_reg_t *pmds, n);
50 Set PMD registers.
51
52 PFM_READ_PMDS
53 perfmonctl(int fd, PFM_READ_PMDS, pfarg_reg_t *pmds, n);
54 Read PMD registers.
55
56 PFM_START
57 perfmonctl(int fd, PFM_START, NULL, 0);
58 Start monitoring.
59
60 PFM_STOP
61 perfmonctl(int fd, PFM_STOP, NULL, 0);
62 Stop monitoring.
63
64 PFM_LOAD_CONTEXT
65 perfmonctl(int fd, PFM_LOAD_CONTEXT, pfarg_load_t *largs, 1);
66 Attach the context to a thread.
67
68 PFM_UNLOAD_CONTEXT
69 perfmonctl(int fd, PFM_UNLOAD_CONTEXT, NULL, 0);
70 Detach the context from a thread.
71
72 PFM_RESTART
73 perfmonctl(int fd, PFM_RESTART, NULL, 0);
74 Restart monitoring after receiving an overflow notification.
75
76 PFM_GET_FEATURES
77 perfmonctl(int fd, PFM_GET_FEATURES, pfarg_features_t *arg, 1);
78
79 PFM_DEBUG
80 perfmonctl(int fd, PFM_DEBUG, val, 0);
81 If val is nonzero, enable debugging mode, otherwise disable.
82
83 PFM_GET_PMC_RESET_VAL
84 perfmonctl(int fd, PFM_GET_PMC_RESET_VAL, pfarg_reg_t *req, n);
85 Reset PMC registers to default values.
86
88 perfmonctl() returns zero when the operation is successful. On error,
89 -1 is returned and errno is set to indicate the error.
90
92 perfmonctl() was added in Linux 2.4; it was removed in Linux 5.10.
93
95 perfmonctl() is Linux-specific and is available only on the IA-64 ar‐
96 chitecture.
97
99 This system call was broken for many years, and ultimately removed in
100 Linux 5.10.
101
102 Glibc does not provide a wrapper for this system call; on kernels where
103 it exists, call it using syscall(2).
104
106 gprof(1)
107
108 The perfmon2 interface specification
109
111 This page is part of release 5.13 of the Linux man-pages project. A
112 description of the project, information about reporting bugs, and the
113 latest version of this page, can be found at
114 https://www.kernel.org/doc/man-pages/.
115
116
117
118Linux 2021-03-22 PERFMONCTL(2)