diff options
author | dm <dm@cvs.openbsd.org> | 1996-08-08 18:47:16 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-08-08 18:47:16 +0000 |
commit | fc324e99fe923f248e62fb00affd7bd498b4de96 (patch) | |
tree | e2ffbcfe4962d0a150f82893ba1e0dcd09ec0d2e /sys/arch/i386/include/pctr.h | |
parent | 007f71c041a4844e5d9550ae4ce2db21388b283d (diff) |
Added a pctr pseudo-device for accessing the Pentium performance counters,
and a program pctrctl to set the counter functions.
Diffstat (limited to 'sys/arch/i386/include/pctr.h')
-rw-r--r-- | sys/arch/i386/include/pctr.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/arch/i386/include/pctr.h b/sys/arch/i386/include/pctr.h new file mode 100644 index 00000000000..641b3436ca5 --- /dev/null +++ b/sys/arch/i386/include/pctr.h @@ -0,0 +1,34 @@ +/* $OpenBSD: pctr.h,v 1.1 1996/08/08 18:47:04 dm Exp $ */ + +/* + * Pentium performance counter driver for OpenBSD. + * Author: David Mazieres <dm@lcs.mit.edu> + */ + +#ifndef _I386_PERFCNT_H_ +#define _I386_PERFCNT_H_ + +typedef u_quad_t pctrval; + +#define PCTR_NUM 2 + +struct pctrst { + u_short pctr_fn[PCTR_NUM]; + pctrval pctr_tsc; + pctrval pctr_hwc[PCTR_NUM]; + pctrval pctr_idl; +}; + +/* Bit values in fn fields and PIOCS ioctl's */ +#define PCTR_K 0x40 /* Monitor kernel-level events */ +#define PCTR_U 0x80 /* Monitor user-level events */ +#define PCTR_C 0x100 /* count cycles rather than events */ + +/* ioctl to set which counter a device tracks. */ +#define PCIOCRD _IOR('c', 1, struct pctrst) /* Read counter value */ +#define PCIOCS0 _IOW('c', 8, unsigned short) /* Set counter 0 function */ +#define PCIOCS1 _IOW('c', 9, unsigned short) /* Set counter 1 function */ + +#define _PATH_PCTR "/dev/pctr" + +#endif /* ! _I386_PERFCNT_H_ */ |