Add stubs to new system calls for performance monitoring interface.
This commit is contained in:
parent
81f3050a76
commit
6f6fd08e8a
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.125 2002/07/10 04:29:10 thorpej Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.126 2002/08/07 04:51:12 briggs Exp $
|
||||
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
|
||||
|
||||
# sys sources
|
||||
@ -58,7 +58,7 @@ ASM= accept.S access.S acct.S bind.S chdir.S chflags.S \
|
||||
mlock.S mlockall.S mount.S mprotect.S __msgctl13.S msgget.S msgrcv.S \
|
||||
msgsnd.S __msync13.S munlock.S munlockall.S munmap.S nanosleep.S \
|
||||
nfssvc.S ntp_gettime.S open.S pathconf.S \
|
||||
poll.S profil.S quotactl.S read.S \
|
||||
pmc_get_info.S pmc_control.S poll.S profil.S quotactl.S read.S \
|
||||
readlink.S readv.S reboot.S recvfrom.S recvmsg.S rename.S revoke.S \
|
||||
rmdir.S select.S semconfig.S semget.S semop.S ____semctl13.S sendmsg.S \
|
||||
sendto.S setegid.S seteuid.S setgid.S setgroups.S setitimer.S \
|
||||
@ -122,7 +122,7 @@ MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
|
||||
madvise.2 mincore.2 minherit.2 mlock.2 mlockall.2 mmap.2 mount.2 \
|
||||
mprotect.2 msgctl.2 msgget.2 msgrcv.2 msgsnd.2 msync.2 \
|
||||
munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 pathconf.2 pipe.2 \
|
||||
poll.2 profil.2 ptrace.2 quotactl.2 read.2 readlink.2 \
|
||||
pmc_control.2 poll.2 profil.2 ptrace.2 quotactl.2 read.2 readlink.2 \
|
||||
reboot.2 recv.2 rename.2 revoke.2 rmdir.2 select.2 semctl.2 \
|
||||
semget.2 semop.2 send.2 setgroups.2 setpgid.2 setregid.2 \
|
||||
setreuid.2 setsid.2 setuid.2 shmat.2 shmctl.2 shmget.2 \
|
||||
@ -161,6 +161,7 @@ MLINKS+=mlockall.2 munlockall.2
|
||||
MLINKS+=mount.2 unmount.2
|
||||
MLINKS+=ntp_adjtime.2 ntp_gettime.2
|
||||
MLINKS+=pathconf.2 fpathconf.2
|
||||
MLINKS+=pmc_control.2 pmc_get_info.2
|
||||
MLINKS+=read.2 readv.2 read.2 pread.2 read.2 preadv.2
|
||||
MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
|
||||
MLINKS+=send.2 sendmsg.2 send.2 sendto.2
|
||||
|
213
lib/libc/sys/pmc_control.2
Normal file
213
lib/libc/sys/pmc_control.2
Normal file
@ -0,0 +1,213 @@
|
||||
.\" $NetBSD: pmc_control.2,v 1.1 2002/08/07 04:51:12 briggs Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002 Wasabi Systems, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Written by Allen Briggs for Wasabi Systems, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed for the NetBSD Project by
|
||||
.\" Wasabi Systems, Inc.
|
||||
.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
.\" or promote products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 23, 2002
|
||||
.Dt PMC_CONTROL 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm pmc_control ,
|
||||
.Nm pmc_get_info
|
||||
.Nd Hardware Performance Monitoring Interface
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include \*[Lt]sys/pmc.h\*[Gt]
|
||||
.Ft int
|
||||
.Fn pmc_control "int ctr" "int op" "void *argp"
|
||||
.Ft int
|
||||
.Fn pmc_get_info "int ctr" "int op" "void *argp"
|
||||
.Sh DESCRIPTION
|
||||
.Fn pmc_get_info
|
||||
returns the number of counters in the system or information on a specified
|
||||
counter
|
||||
.Fa ctr .
|
||||
The possible values for
|
||||
.Fa op
|
||||
are:
|
||||
.Bl -tag -width width
|
||||
.It PMC_INFO_NCOUNTERS
|
||||
When querying the number of counters in the system,
|
||||
.Fa ctr
|
||||
is ignored and
|
||||
.Fa argp
|
||||
is of type
|
||||
.Em int * .
|
||||
Upon return, the integer pointed to by
|
||||
.Fa argp
|
||||
will contain the number of counters that are available in the system.
|
||||
.It PMC_INFO_COUNTER_VALUE
|
||||
When querying the value of a counter in the system,
|
||||
.Fa ctr
|
||||
refers to the counter being queried, and
|
||||
.Fa argp
|
||||
is of type
|
||||
.Em uint64_t * .
|
||||
Upon return, the 64-bit integer pointed to by
|
||||
.Fa argp
|
||||
will contain the value of the specified counter.
|
||||
.It PMC_INFO_ACCUMULATED_COUNTER_VALUE
|
||||
When querying the value of a counter in the system,
|
||||
.Fa ctr
|
||||
refers to the counter being queried, and
|
||||
.Fa argp
|
||||
is of type
|
||||
.Em uint64_t * .
|
||||
Upon return, the 64-bit integer pointed to by
|
||||
.Fa argp
|
||||
will contain the sum of the accumulated values of specified counter in
|
||||
all exited subprocesses of the current process.
|
||||
.El
|
||||
.Pp
|
||||
.Fn pmc_control
|
||||
manipulates the specified counter
|
||||
.Fa ctr
|
||||
in one of several fashions. The
|
||||
.Fa op
|
||||
parameter determines the action taken by the kernel and also the interpretation of the
|
||||
.Fa argp
|
||||
parameter. The possible values for
|
||||
.Fa op
|
||||
are:
|
||||
.Bl -tag -width width
|
||||
.It PMC_OP_START
|
||||
Starts the specified
|
||||
.Fa ctr
|
||||
running. It must be preceded by a call with
|
||||
.Em PMC_OP_CONFIGURE .
|
||||
.Fa argp
|
||||
is ignored in this case and may be
|
||||
.Dv NULL .
|
||||
.It PMC_OP_STOP
|
||||
Stops the specified
|
||||
.Fa ctr
|
||||
from running.
|
||||
.Fa argp
|
||||
is ignored in this case and may be
|
||||
.Dv NULL .
|
||||
.It PMC_OP_CONFIGURE
|
||||
Configures the specified
|
||||
.Fa ctr
|
||||
prior to running.
|
||||
.Fa argp
|
||||
is a pointer to a
|
||||
.Em struct pmc_counter_cfg .
|
||||
.Bd -literal
|
||||
struct pmc_counter_cfg {
|
||||
pmc_evid_t event_id;
|
||||
pmc_ctr_t reset_value;
|
||||
uint32_t flags;
|
||||
};
|
||||
.Ed
|
||||
.Bl -tag -width width
|
||||
.It Dv event_id
|
||||
is the event ID to be counted.
|
||||
.It Dv reset_value
|
||||
is a value to which the counter should be reset on overflow (if supported
|
||||
by the implementation). This is most useful when profiling (see
|
||||
.Em PMC_OP_PROFSTART ,
|
||||
below). This value is defined to be the number of counter ticks before
|
||||
the next overflow. So, to get a profiling tick on every hundredth data
|
||||
cache miss, set the
|
||||
.Dv event_id
|
||||
to the proper value for
|
||||
.Dq dcache-miss
|
||||
and set
|
||||
.Dv reset_value
|
||||
to 100.
|
||||
.It Dv flags
|
||||
Currently unused.
|
||||
.El
|
||||
.It PMC_OP_PROFSTART
|
||||
Configures the specified
|
||||
.Fa ctr
|
||||
for use in profiling.
|
||||
.Fa argp
|
||||
is a pointer to a
|
||||
.Em struct pmc_counter_cfg
|
||||
as in
|
||||
.Em PMC_OP_CONFIGURE ,
|
||||
above. This request allocates a kernel counter, which will fail if any
|
||||
process is using the requested counter.
|
||||
Not all implementations or counters may support this option.
|
||||
.It PMC_OP_PROFSTOP
|
||||
Stops the specified
|
||||
.Fa ctr
|
||||
from being used for profiling.
|
||||
.Fa argp
|
||||
is ignored in this case and may be
|
||||
.Dv NULL .
|
||||
.El
|
||||
.Sh RETURN VALUES
|
||||
A return value of 0 indicates that the call succeeded. Otherwise, -1 is
|
||||
returned and the global variable
|
||||
.Va errno
|
||||
is set to indicate the error.
|
||||
.Sh ERRORS
|
||||
Among the possible error codes from
|
||||
.Fn pmc_control
|
||||
and
|
||||
.Fn pmc_get_info
|
||||
are
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EFAULT
|
||||
The address specified for the
|
||||
.Fa argp
|
||||
is invalid.
|
||||
.It Bq Er ENXIO
|
||||
Specified counter is not yet configured.
|
||||
.It Bq Er EINPROGRESS
|
||||
.Dv PMC_OP_START
|
||||
was passed for a counter that is already running.
|
||||
.It Bq Er EINVAL
|
||||
Specified counter was invalid.
|
||||
.It Bq Er EBUSY
|
||||
If the requested counter is already in use--either by the current process
|
||||
or by the kernel.
|
||||
.It Bq Er ENODEV
|
||||
If and only if the specified counter event is not valid for the specified
|
||||
counter when configuring a counter or starting profiling.
|
||||
.It Bq Er ENOMEM
|
||||
If the kernel is unable to allocate memory.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr pmc 1 ,
|
||||
.Xr pmc 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn pmc_control
|
||||
and
|
||||
.Fn pmc_get_info
|
||||
system calls appeared in
|
||||
.Nx 2.0 .
|
Loading…
Reference in New Issue
Block a user