]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/perfmonctl.2
sched_setattr.2: tfix
[thirdparty/man-pages.git] / man2 / perfmonctl.2
CommitLineData
55b9301b 1.\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
f2b29ffe 2.\" and Copyright (C) 2013 Michael Kerrisk <mtk.manpages@gmail.com>
55b9301b
IV
3.\" Written by Ivana Varekova <varekova@redhat.com>
4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
55b9301b
IV
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
14.\"
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
22.\"
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
55b9301b 26.\"
4b8c67d9 27.TH PERFMONCTL 2 2017-09-15 Linux "Linux Programmer's Manual"
55b9301b 28.SH NAME
3dfb8d01 29perfmonctl \- interface to IA-64 performance monitoring unit
55b9301b
IV
30.SH SYNOPSIS
31.nf
32.B #include <syscall.h>
33.B #include <perfmon.h>
68e4db0a 34.PP
55b9301b
IV
35.BI "long perfmonctl(int " fd ", int " cmd ", void *" arg ", int " narg ");
36.fi
439335f7
MK
37.IR Note :
38There is no glibc wrapper for this system call; see NOTES.
55b9301b 39.SH DESCRIPTION
3c7e310c
MK
40The IA-64-specific
41.BR perfmonctl ()
42system call provides an interface to the
43PMU (performance monitoring unit).
44The PMU consists of PMD (performance monitoring data) registers and
3dfb8d01 45PMC (performance monitoring control) registers,
3c7e310c 46which gather hardware statistics.
efeece04 47.PP
3c7e310c
MK
48.BR perfmonctl ()
49applies the operation
55b9301b 50.I cmd
3c7e310c
MK
51to the input arguments specified by
52.IR arg .
53The number of arguments is defined by \fInarg\fR.
54The
55b9301b 55.I fd
3c7e310c 56argument specifies the perfmon context to operate on.
efeece04 57.PP
3c7e310c 58Supported values for
55b9301b
IV
59.I cmd
60are:
55b9301b 61.TP
3dfb8d01 62.B PFM_CREATE_CONTEXT
55b9301b 63.nf
3c7e310c 64.BI "perfmonctl(int " fd ", PFM_CREATE_CONTEXT, pfarg_context_t *" ctxt ", 1);
55b9301b 65.fi
3dfb8d01 66Set up a context.
efeece04 67.IP
55b9301b
IV
68The
69.I fd
3c7e310c
MK
70parameter is ignored.
71A new perfmon context is created as specified in
55b9301b
IV
72.I ctxt
73and its file descriptor is returned in \fIctxt->ctx_fd\fR.
efeece04 74.IP
0609db2a
MK
75The file descriptor can be used in subsequent calls to
76.BR perfmonctl ()
77and can be used to read event notifications (type
78.IR pfm_msg_t )
79using
80.BR read (2).
81The file descriptor is pollable using
82.BR select (2),
83.BR poll (2),
55b9301b 84and
0609db2a 85.BR epoll (7).
efeece04 86.IP
0609db2a 87The context can be destroyed by calling
55b9301b 88.BR close (2)
0609db2a 89on the file descriptor.
55b9301b
IV
90.TP
91.B PFM_WRITE_PMCS
3c7e310c 92.\" pfm_write_pmcs()
55b9301b 93.nf
f25e7c8e 94.BI "perfmonctl(int " fd ", PFM_WRITE_PMCS, pfarg_reg_t *" pmcs ", n);
55b9301b 95.fi
3dfb8d01
MK
96Set PMC registers.
97.TP
3c7e310c 98.B PFM_WRITE_PMDS
55b9301b 99.nf
f25e7c8e 100.BI "perfmonctl(int " fd ", PFM_WRITE_PMDS, pfarg_reg_t *" pmds ", n);
55b9301b 101.fi
3dfb8d01
MK
102.\" pfm_write_pmds()
103Set PMD registers.
55b9301b 104.TP
3c7e310c
MK
105.B PFM_READ_PMDS
106.\" pfm_read_pmds()
55b9301b 107.nf
f25e7c8e 108.BI "perfmonctl(int " fd ", PFM_READ_PMDS, pfarg_reg_t *" pmds ", n);
55b9301b 109.fi
3dfb8d01 110Read PMD registers.
55b9301b 111.TP
3c7e310c
MK
112.B PFM_START
113.\" pfm_start()
55b9301b 114.nf
3c7e310c
MK
115.\" .BI "perfmonctl(int " fd ", PFM_START, arg, 1);
116.BI "perfmonctl(int " fd ", PFM_START, NULL, 0);
55b9301b 117.fi
3dfb8d01 118Start monitoring.
55b9301b 119.TP
3dfb8d01 120.B PFM_STOP
3c7e310c 121.\" pfm_stop()
55b9301b 122.nf
e2b6e497 123.BI "perfmonctl(int " fd ", PFM_STOP, NULL, 0);
55b9301b 124.fi
3dfb8d01 125Stop monitoring.
55b9301b 126.TP
3c7e310c
MK
127.B PFM_LOAD_CONTEXT
128.\" pfm_context_load()
55b9301b 129.nf
3c7e310c 130.BI "perfmonctl(int " fd ", PFM_LOAD_CONTEXT, pfarg_load_t *" largs ", 1);
55b9301b 131.fi
3dfb8d01 132Attach the context to a thread.
55b9301b 133.TP
3dfb8d01 134.B PFM_UNLOAD_CONTEXT
3c7e310c 135.\" pfm_context_unload()
55b9301b 136.nf
3c7e310c 137.BI "perfmonctl(int " fd ", PFM_UNLOAD_CONTEXT, NULL, 0);
55b9301b 138.fi
3dfb8d01 139Detach the context from a thread.
55b9301b 140.TP
3dfb8d01 141.B PFM_RESTART
3c7e310c 142.\" pfm_restart()
55b9301b 143.nf
3c7e310c 144.BI "perfmonctl(int " fd ", PFM_RESTART, NULL, 0);
55b9301b 145.fi
3dfb8d01 146Restart monitoring after receiving an overflow notification.
f2b29ffe
MK
147.TP
148.B PFM_GET_FEATURES
149.\" pfm_get_features()
150.nf
1a6de328 151.BI "perfmonctl(int " fd ", PFM_GET_FEATURES, pfarg_features_t *" arg ", 1);
f2b29ffe
MK
152.fi
153.TP
154.B PFM_DEBUG
155.\" pfm_debug()
156.nf
e2b6e497 157.BI "perfmonctl(int " fd ", PFM_DEBUG, " val ", 0);
f2b29ffe
MK
158.fi
159If
160.I val
161is nonzero, enable debugging mode, otherwise disable.
162.TP
163.B PFM_GET_PMC_RESET_VAL
164.\" pfm_get_pmc_reset()
165.nf
70bdb9b5 166.BI "perfmonctl(int " fd ", PFM_GET_PMC_RESET_VAL, pfarg_reg_t *" req ", n);
f2b29ffe
MK
167.fi
168Reset PMC registers to default values.
06a2b631
MK
169.\"
170.\"
734fd1f2 171.\" .TP
3dfb8d01
MK
172.\" .B PFM_CREATE_EVTSETS
173.\"
734fd1f2
MK
174.\" create or modify event sets
175.\" .nf
176.\" .BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
177.\" .fi
178.\" .TP
3dfb8d01 179.\" .B PFM_DELETE_EVTSETS
734fd1f2
MK
180.\" delete event sets
181.\" .nf
182.\" .BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
183.\" .fi
184.\" .TP
3dfb8d01
MK
185.\" .B PFM_GETINFO_EVTSETS
186.\" get information about event sets
734fd1f2
MK
187.\" .nf
188.\" .BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
189.\" .fi
47297adb 190.SH RETURN VALUE
9f001135 191.BR perfmonctl ()
55b9301b 192returns zero when the operation is successful.
65d669f4
MK
193On error, \-1 is returned and
194.I errno
195is set to indicate the cause of the error.
39e10583
MK
196.SH VERSIONS
197.BR perfmonctl ()
198is available since Linux 2.4.
39e10583
MK
199.SH CONFORMING TO
200.BR perfmonctl ()
76c637e1 201is Linux-specific and is available only on the IA-64 architecture.
439335f7
MK
202.SH NOTES
203Glibc does not provide a wrapper for this system call; call it using
204.BR syscall (2).
47297adb 205.SH SEE ALSO
e2b6e497 206.BR gprof (1)
efeece04 207.PP
e2b6e497 208The perfmon2 interface specification