1perfmonctl(2) System Calls 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[.narg], int narg);
13
14 Note: There is no glibc wrapper for this system call; see HISTORY.
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 Linux on IA-64.
93
95 Added in Linux 2.4; removed in Linux 5.10.
96
97 This system call was broken for many years, and ultimately removed in
98 Linux 5.10.
99
100 glibc does not provide a wrapper for this system call; on kernels where
101 it exists, call it using syscall(2).
102
104 gprof(1)
105
106 The perfmon2 interface specification
107
108
109
110Linux man-pages 6.05 2023-03-30 perfmonctl(2)