man-pages/man2/perfmonctl.2.html
2021-03-31 01:06:50 +01:00

292 lines
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of PERFMONCTL</TITLE>
</HEAD><BODY>
<H1>PERFMONCTL</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
perfmonctl - interface to IA-64 performance monitoring unit
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/syscall.h">syscall.h</A>&gt;</B>
<B>#include &lt;<A HREF="file:///usr/include/perfmon.h">perfmon.h</A>&gt;</B>
<B>long perfmonctl(int </B><I>fd</I><B>, int </B><I>cmd</I><B>, void *</B><I>arg</I><B>, int </B><I>narg</I><B>);</B>
</PRE>
<I>Note</I>:
There is no glibc wrapper for this system call; see NOTES.
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The IA-64-specific
<B>perfmonctl</B>()
system call provides an interface to the
PMU (performance monitoring unit).
The PMU consists of PMD (performance monitoring data) registers and
PMC (performance monitoring control) registers,
which gather hardware statistics.
<P>
<B>perfmonctl</B>()
applies the operation
<I>cmd</I>
to the input arguments specified by
<I>arg</I>.
The number of arguments is defined by <I>narg</I>.
The
<I>fd</I>
argument specifies the perfmon context to operate on.
<P>
Supported values for
<I>cmd</I>
are:
<DL COMPACT>
<DT id="1"><B>PFM_CREATE_CONTEXT</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_CREATE_CONTEXT, pfarg_context_t *</B><I>ctxt</I><B>, 1);</B>
</PRE>
Set up a context.
<DT id="2"><DD>
The
<I>fd</I>
parameter is ignored.
A new perfmon context is created as specified in
<I>ctxt</I>
and its file descriptor is returned in <I>ctxt-&gt;ctx_fd</I>.
<DT id="3"><DD>
The file descriptor can be used in subsequent calls to
<B>perfmonctl</B>()
and can be used to read event notifications (type
<I>pfm_msg_t</I>)
using
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2).
The file descriptor is pollable using
<B><A HREF="/cgi-bin/man/man2html?2+select">select</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+poll">poll</A></B>(2),
and
<B><A HREF="/cgi-bin/man/man2html?7+epoll">epoll</A></B>(7).
<DT id="4"><DD>
The context can be destroyed by calling
<B><A HREF="/cgi-bin/man/man2html?2+close">close</A></B>(2)
on the file descriptor.
<DT id="5"><B>PFM_WRITE_PMCS</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_WRITE_PMCS, pfarg_reg_t *</B><I>pmcs</I><B>, n);</B>
</PRE>
Set PMC registers.
<DT id="6"><B>PFM_WRITE_PMDS</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_WRITE_PMDS, pfarg_reg_t *</B><I>pmds</I><B>, n);</B>
</PRE>
Set PMD registers.
<DT id="7"><B>PFM_READ_PMDS</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_READ_PMDS, pfarg_reg_t *</B><I>pmds</I><B>, n);</B>
</PRE>
Read PMD registers.
<DT id="8"><B>PFM_START</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_START, NULL, 0);</B>
</PRE>
Start monitoring.
<DT id="9"><B>PFM_STOP</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_STOP, NULL, 0);</B>
</PRE>
Stop monitoring.
<DT id="10"><B>PFM_LOAD_CONTEXT</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_LOAD_CONTEXT, pfarg_load_t *</B><I>largs</I><B>, 1);</B>
</PRE>
Attach the context to a thread.
<DT id="11"><B>PFM_UNLOAD_CONTEXT</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_UNLOAD_CONTEXT, NULL, 0);</B>
</PRE>
Detach the context from a thread.
<DT id="12"><B>PFM_RESTART</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_RESTART, NULL, 0);</B>
</PRE>
Restart monitoring after receiving an overflow notification.
<DT id="13"><B>PFM_GET_FEATURES</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_GET_FEATURES, pfarg_features_t *</B><I>arg</I><B>, 1);</B>
</PRE>
<DT id="14"><B>PFM_DEBUG</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_DEBUG, </B><I>val</I><B>, 0);</B>
</PRE>
If
<I>val</I>
is nonzero, enable debugging mode, otherwise disable.
<DT id="15"><B>PFM_GET_PMC_RESET_VAL</B>
<DD>
<PRE>
<B>perfmonctl(int </B><I>fd</I><B>, PFM_GET_PMC_RESET_VAL, pfarg_reg_t *</B><I>req</I><B>, n);</B>
</PRE>
Reset PMC registers to default values.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<B>perfmonctl</B>()
returns zero when the operation is successful.
On error, -1 is returned and
<I>errno</I>
is set to indicate the cause of the error.
<A NAME="lbAF">&nbsp;</A>
<H2>VERSIONS</H2>
<B>perfmonctl</B>()
is available since Linux 2.4.
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
<B>perfmonctl</B>()
is Linux-specific and is available only on the IA-64 architecture.
<A NAME="lbAH">&nbsp;</A>
<H2>NOTES</H2>
Glibc does not provide a wrapper for this system call; call it using
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2).
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+gprof">gprof</A></B>(1)
<P>
The perfmon2 interface specification
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="19"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="20"><A HREF="#lbAF">VERSIONS</A><DD>
<DT id="21"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DT id="22"><A HREF="#lbAH">NOTES</A><DD>
<DT id="23"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="24"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:33 GMT, March 31, 2021
</BODY>
</HTML>