$Id: README,v 1.41 2003/02/24 17:57:16 mikpe Exp $

	   Linux x86 Performance-Monitoring Counters Driver
		by Mikael Pettersson <mikpe@csd.uu.se>
========================================================================


Overview
--------
This package adds support to the Linux kernel for using the
Performance-Monitoring Counters (PMCs) found in many modern
x86-class processors. Supported processors are:
- All Intel Pentium processors, i.e. Pentium, Pentium MMX,
  Pentium Pro, Pentium II, Pentium III, and Pentium 4, including
  Celeron and Xeon versions.
- The AMD K7 and K8 processor families.
- Cyrix 6x86MX, MII, and III.
- VIA C3 (Cyrix III).
- Centaur WinChip C6/2/3.

PMCs are "event counters" capable of recording any of a large
number of performance-related events during execution.
These events typically include instructions executed, cache
misses, TLB misses, stalls, and other events specific to
the microarchitecture of the processor being used.

PMCs are primarily used to identify low-level performance problems,
and to validate code changes intended to improve performance.

Limited support is available for generic x86 processors with
a Time-Stamp Counter but no PMCs, such as the AMD K6 family.
For these processors, only TSC-based cycle-count measurements
are possible. However, all high-level facilities implemented
by the driver are still available.


Features
--------
Each Linux process has its own set of "virtual" PMCs. That is,
to a process the PMCs appear to be private and unrelated to the
activities of other processes in the system. The virtual PMCs
have 64-bit precision, even though current processors only
implement 40 or 48-bit PMCs. Each process also has a virtual
Time-Stamp Counter (TSC). On most machines, the virtual PMCs can
be sampled entirely in user-space without incurring the overhead
of a system call.

A process accesses its virtual PMCs by opening /proc/self/perfctr
and issuing system calls on the resulting file descriptor. A
user-space library is included which provides a more high-level
interface.

The driver also supports global-mode or system-wide PMCs.
In this mode, each PMC on each processor can be controlled
and read. The PMCs and TSC on active processors are sampled
periodically and the accumulated sums have 64-bit precision.
Global-mode PMCs are accessed via the /dev/perfctr device file;
the user-space library provides a more high-level interface.

The user-space library is accompanied by several example programs
that illustrate how the driver and the library can be used.

Support for performance-counter overflow interrupts is provided
for Intel P4 and P6, and AMD K7 and K8 processors.


Limitations
-----------
- Hyper-threaded Pentium 4s require a 2.4 or newer kernel.
- The performance counter interrupt facility requires a 2.4.10
  or newer kernel, or an earlier 2.4-ac kernel, or a vendor kernel
  based on any of these. The kernel must also be configured with
  SMP or uniprocessor APIC support.
- Almost no documentation. "Use the source, Luke."
- Neither the kernel driver nor the sample user-space library
  attempt to hide any processor-specific details from the user.
- This package makes it possible to compute aggregate event and
  cycle counts for sections of code. Since many x86-type processors
  use out-of-order execution, it is impossible to attribute exact
  event or cycle counts to individual instructions.
  See the "Continuous Profiling" and "ProfileMe" papers at Compaq's
  DCPI web site for more information on this issue. (The URL is
  listed in the OTHERS file.)
- Centaur WinChip C6/2/3 support requires that the TSC is disabled.
  See linux/drivers/perfctr/x86.c for further information.


Availability
------------
This and future versions of this package can be downloaded from
<http://www.csd.uu.se/~mikpe/linux/perfctr/>.

The perfctr-devel mailing list is an open forum for driver update
announcements and general discussions about the perfctr driver
and its usage. To subscribe to perfctr-devel, visit
<http://lists.sourceforge.net/lists/listinfo/perfctr-devel>.


Licensing
---------
Copyright (C) 1999-2003  Mikael Pettersson <mikpe@csd.uu.se>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
