Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpmc Add a user interface library to the PMC-related s...



details:   https://anonhg.NetBSD.org/src/rev/2b8ea0fa3a30
branches:  trunk
changeset: 535035:2b8ea0fa3a30
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Aug 09 00:03:15 2002 +0000

description:
Add a user interface library to the PMC-related system calls.  This
provides a mapping between an event name and the selector, and provides
a more convenient API For manipulating the PMCs.

diffstat:

 lib/libpmc/Makefile      |   17 +
 lib/libpmc/pmc.3         |  815 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/libpmc/pmc.c         |  238 +++++++++++++
 lib/libpmc/pmc.h         |   65 +++
 lib/libpmc/pmc_arm.c     |   82 ++++
 lib/libpmc/pmc_i386.c    |  413 +++++++++++++++++++++++
 lib/libpmc/pmc_private.h |   45 ++
 lib/libpmc/shlib_version |    4 +
 8 files changed, 1679 insertions(+), 0 deletions(-)

diffs (truncated from 1711 to 300 lines):

diff -r 83f8807a0b3b -r 2b8ea0fa3a30 lib/libpmc/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libpmc/Makefile       Fri Aug 09 00:03:15 2002 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.1 2002/08/09 00:03:15 thorpej Exp $
+
+.include <bsd.own.mk>
+
+MAN=   pmc.3
+
+.if exists(${.CURDIR}/pmc_${MACHINE_CPU}.c)
+LIB=   pmc
+SRCS=  pmc.c
+SRCS+= pmc_${MACHINE_CPU}.c
+
+INCS=  pmc.h
+INCSDIR=/usr/include
+.include <bsd.lib.mk>
+.else
+.include <bsd.man.mk>
+.endif
diff -r 83f8807a0b3b -r 2b8ea0fa3a30 lib/libpmc/pmc.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libpmc/pmc.3  Fri Aug 09 00:03:15 2002 +0000
@@ -0,0 +1,815 @@
+.\"    $NetBSD: pmc.3,v 1.1 2002/08/09 00:03:15 thorpej Exp $
+.\"
+.\" Copyright (c) 2002 Wasabi Systems, Inc.
+.\" All rights reserved.
+.\"
+.\" Written by Jason R. Thorpe 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 August 8, 2002
+.Dt PMC 3
+.Os
+.Sh NAME
+.Nm pmc_configure_counter ,
+.Nm pmc_start_counter ,
+.Nm pmc_stop_counter ,
+.Nm pmc_get_num_counters ,
+.Nm pmc_get_counter_class ,
+.Nm pmc_get_counter_type ,
+.Nm pmc_get_counter_value ,
+.Nm pmc_get_accumulated_counter_value ,
+.Nm pmc_get_counter_class_name ,
+.Nm pmc_get_counter_type_name ,
+.Nm pmc_get_counter_event_name ,
+.Nm pmc_get_counter_event_list
+.Nd performance counter interface library
+.Sh LIBRARY
+.Lb libpmc
+.Sh SYNOPSIS
+.Fd #include \*[Lt]pmc.h\*[Gt]
+.Ft int
+.Fn pmc_configure_counter "int ctr" "const char *evname" \
+    "pmc_ctr_t reset_val" "uint32_t flags"
+.Ft int
+.Fn pmc_start_counter "int ctr"
+.Ft int
+.Fn pmc_stop_counter "int ctr"
+.Ft int
+.Fn pmc_get_num_counters "void"
+.Ft int
+.Fn pmc_get_counter_class "void"
+.Ft int
+.Fn pmc_get_counter_type "int ctr" "int *typep"
+.Ft int
+.Fn pmc_get_counter_value "int ctr" "uint64_t *valp"
+.Ft int
+.Fn pmc_get_accumulated_counter_value "int ctr" "uint64_t *valp"
+.Ft const char *
+.Fn pmc_get_counter_class_name "int class"
+.Ft const char *
+.Fn pmc_get_counter_type_name "int type"
+.Ft const char *
+.Fn pmc_get_counter_event_name "pmc_evid_t event"
+.Ft const struct pmc_event *
+.Fn pmc_get_counter_event_list "void"
+.Sh DESCRIPTION
+The
+.Nm pmc
+library is an interface to performance monitoring counters available
+on some CPUs.
+.Pp
+The
+.Nm pmc
+library can count events on the following CPU families.  Each second-level
+entry describes a performance counter class.  A given class may apply to
+muitple individual CPU models.  Each class has one or more counter types.
+A CPU may have more than one counter of a given type.  Refer to the
+corresponding processor programmer's manual for more information about
+individual events.
+.Bl -bullet
+.It
+ARM
+.Bl -bullet
+.It
+Intel i80200
+.Pq PMC_TYPE_I80200
+.Pp
+There are two types of counters available in this class:
+.Bl -tag -width PMC_TYPE_I80200_CCNTxx
+.It PMC_TYPE_I80200_CCNT
+cycle counter
+.It PMC_TYPE_I80200_PMCx
+performance counter
+.El
+.Pp
+The following events may be counted by a counter of type
+PMC_TYPE_I80200_CCNT:
+.Pp
+.Bl -item -offset indent -compact
+.It
+clock
+.It
+clock-div-64
+.El
+.Pp
+The following events may be counted by a counter of type
+PMC_TYPE_I80200_PMCx:
+.Pp
+.Bl -item -offset indent -compact
+.It
+insfetch-miss
+.It
+insfetch-stall
+.It
+datadep-stall
+.It
+itlb-miss
+.It
+dtlb-miss
+.It
+branch-taken
+.It
+branch-mispredicted
+.It
+instruction-executed
+.It
+dcachebufffull-stall-time
+.It
+dcachebufffull-stall-count
+.It
+dcache-access
+.It
+dcache-miss
+.It
+dcache-writeback
+.It
+swchange-pc
+.It
+bcu-mem-request
+.It
+bcu-queue-full
+.It
+bcu-queue-drain
+.It
+bcu-ecc-no-elog
+.It
+bcu-1bit-error
+.It
+narrow-ecc-caused-rmw
+.El
+.El
+.It
+i386
+.Bl -bullet
+.It
+Intel i586
+.Pq PMC_TYPE_I586
+.Pp
+There are two types of counters available in this class:
+.Bl -tag -width PMC_TYPE_I586_PMCxxx
+.It PMC_TYPE_I586_TSC
+cycle counter
+.It PMC_TYPE_I586_PMCx
+performance counter
+.El
+.Pp
+The following events may be counted by a ounter of type
+PMC_TYPE_I586_PMCx:
+.Pp
+.Bl -item -offset indent -compact
+.It
+tlb-data-miss
+.It
+tlb-ins-miss
+.It
+l1cache-ins-miss
+.It
+l1cache-data-miss
+.It
+l1cache-data-miss-read
+.It
+l1cache-data-miss-write
+.It
+l1cache-writeback
+.It
+l1cache-writeback-hit
+.It
+l2cache-data-snoop
+.It
+l2cache-data-snoop-hit
+.It
+mem-read
+.It
+mem-write
+.It
+mem-access
+.It
+mem-access-both-pipes
+.It
+mem-bank-conflicts
+.It
+mem-misalign-ref
+.It
+mem-uncached-read
+.It
+seg-load-any
+.It
+branch
+.It
+branch-btb-hit
+.It
+branch-taken
+.It
+ins-read
+.It
+ins-pipeline-flush
+.It
+ins-executed
+.It
+ins-executed-vpipe
+.It
+ins-stall-agi
+.It
+ins-stall-write
+.It
+ins-stall-data
+.It
+ins-stall-writeline
+.It
+bus-utilization
+.It
+bus-locked
+.It
+bus-io-cycle
+.It
+fpu-flops
+.It
+int-hw
+.It
+break-match0
+.It
+break-match1
+.It
+break-match2
+.It
+break-match3
+.El
+.It
+Intel i686
+.Pq PMC_TYPE_I686
+.Pp
+There are two types of counters available in this class:
+.Bl -tag -width PMC_TYPE_I686_PMCxxx
+.It PMC_TYPE_I686_TSC
+cycle counter
+.It PMC_TYPE_I686_PMCx
+performance counter
+.El
+.Pp



Home | Main Index | Thread Index | Old Index