]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/perfmonctl.2
perfmonctl.2: New page documenting IA-64-specific perfmonctl(2)
[thirdparty/man-pages.git] / man2 / perfmonctl.2
CommitLineData
55b9301b
IV
1.\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
2.\" Written by Ivana Varekova <varekova@redhat.com>
3.\"
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
12.\"
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
23.\"
24.\"
25.TH PERFMONCTL 2 "28 August 2006" Linux "Linux System Calls"
26.SH NAME
27perfmonctl \- interface to PMU
28.SH SYNOPSIS
29.nf
30.B #include <syscall.h>
31.B #include <perfmon.h>
32.sp
33.BI "long perfmonctl(int " fd ", int " cmd ", void *" arg ", int " narg ");
34.fi
35.SH DESCRIPTION
36.B perfmonctl
37system call provides an interface to PMU (performance monitoring unit).
38PMU consists of PMD (performance monitoring data) registers and
39PMC (performance monitoring control) registers, where are
40gathered the hardware statistic.
41
42.B perfmonctl
43will apply a function
44.I cmd
45to input arguments
46.I arg.
47The number of arguments is defined by input variable \fInarg\fR.
48.I fd
49specifies the perfmon context to operate on.
50
51The implemented commands
52.I cmd
53are:
54
55.TP
56.B PFM_CREATE_CONTEXT
57set up a context
58.nf
59.BI "perfmonctl(int " fd ", PFM_CREATE_CONTEXT , pfarg_context_t *" ctxt ", 1);
60.fi
61
62The
63.I fd
64parameter is ignored. A new context is created as specified in
65.I ctxt
66and its file descriptor is returned in \fIctxt->ctx_fd\fR.
67
68The file descriptor, apart from passing it to \fBperfmonctl\fR,
69can be used to read event notifications (type
70\fBpfm_msg_t\fR) using the
71.BR read (2)
72system call.
73Both
74.BR select (2)
75and
76.BR poll (2)
77can be used to wait for event notifications.
78
79The context can be destroyed using the
80.BR close (2)
81system call.
82.TP
83.B PFM_WRITE_PMCS
84set PMC registers
85.nf
86.BI "perfmonctl(int " fd ", PFM_WRITE_PMCS , pfarg_pmc_t *" pmcs ", n);
87.fi
88.TP
89.B PFM_WRITE_PMDS
90set PMD registers
91.nf
92.BI "perfmonctl(int " fd ", PFM_WRITE_PMDS , pfarg_pmd_t *" pmds ", n);
93.fi
94.TP
95.B PFM_READ_PMDS
96read PMD registers
97.nf
98.BI "perfmonctl(int " fd ", PFM_READ_PMDS , pfarg_pmd_t *" pmds ", n);
99.fi
100.TP
101.B PFM_START
102start monitoring
103.nf
104.BI "perfmonctl(int " fd ", PFM_START , arg , 1);
105.BI "perfmonctl(int " fd ", PFM_START , NULL , 0);
106.fi
107.TP
108.B PFM_STOP
109stop monitoring
110.nf
111.BI "perfmonctl(int " fd ", PFM_START , NULL , 0);
112.fi
113.TP
114.B PFM_LOAD_CONTEXT
115attach the context to a thread
116.nf
117.BI "perfmonctl(int " fd ", PFM_LOAD_CONTEXT ,pfarg_load_t *" largs , 1);
118.fi
119.TP
120.B PFM_UNLOAD_CONTEXT
121detach the context from a thread
122.nf
123.BI "perfmonctl(int " fd ", PFM_UNLOAD_CONTEXT , NULL , 0);
124.fi
125.TP
126.B PFM_RESTART
127restart monitoring after receiving an overflow notification
128.nf
129.BI "perfmonctl(int " fd ", PFM_RESTART , NULL , 0);
130.fi
131.TP
132.B PFM_CREATE_EVTSETS
133create or modify event sets
134.nf
135.BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
136.fi
137.TP
138.B PFM_DELETE_EVTSETS
139delete event sets
140.nf
141.BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
142.fi
143.TP
144.B PFM_GETINFO_EVTSETS
145get information about event sets
146.nf
147.BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
148.fi
149
150.SH "RETURN VALUE"
151.B performctl
152returns zero when the operation is successful.
153On error -1 is returned and an error code is set in \fBerrno\fR.
154
155.SH AVAILABILITY
156This syscall is implemented only on the IA-64 architecture since kernel 2.6.
157
158.SH "SEE ALSO"
159.BR gprof(1),
160The perfmon2 interface specification