libpmc.c (145340) | libpmc.c (145351) |
---|---|
1/*- 2 * Copyright (c) 2003,2004 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003,2004 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libpmc/libpmc.c 145340 2005-04-20 20:48:24Z marcel $"); | 28__FBSDID("$FreeBSD: head/lib/libpmc/libpmc.c 145351 2005-04-21 05:50:25Z jkoshy $"); |
29 30#include <sys/types.h> 31#include <sys/module.h> 32#include <sys/pmc.h> 33#include <sys/syscall.h> 34 35#include <ctype.h> 36#include <errno.h> --- 145 unchanged lines hidden (view full) --- 182 183#if defined(__i386__) 184 185/* 186 * AMD K7 (Athlon) CPUs. 187 */ 188 189static struct pmc_event_alias k7_aliases[] = { | 29 30#include <sys/types.h> 31#include <sys/module.h> 32#include <sys/pmc.h> 33#include <sys/syscall.h> 34 35#include <ctype.h> 36#include <errno.h> --- 145 unchanged lines hidden (view full) --- 182 183#if defined(__i386__) 184 185/* 186 * AMD K7 (Athlon) CPUs. 187 */ 188 189static struct pmc_event_alias k7_aliases[] = { |
190EV_ALIAS("branches", "k7-retired-branches"), 191EV_ALIAS("branch-mispredicts", "k7-retired-branches-mispredicted"), 192EV_ALIAS("cycles", "tsc"), 193EV_ALIAS("dc-misses", "k7-dc-misses,mask=moesi"), 194EV_ALIAS("ic-misses", "k7-ic-misses"), 195EV_ALIAS("instructions", "k7-retired-instructions"), 196EV_ALIAS("interrupts", "k7-hardware-interrupts"), 197EV_ALIAS(NULL, NULL) | 190 EV_ALIAS("branches", "k7-retired-branches"), 191 EV_ALIAS("branch-mispredicts", "k7-retired-branches-mispredicted"), 192 EV_ALIAS("cycles", "tsc"), 193 EV_ALIAS("dc-misses", "k7-dc-misses,mask=moesi"), 194 EV_ALIAS("ic-misses", "k7-ic-misses"), 195 EV_ALIAS("instructions", "k7-retired-instructions"), 196 EV_ALIAS("interrupts", "k7-hardware-interrupts"), 197 EV_ALIAS(NULL, NULL) |
198}; 199 200#define K7_KW_COUNT "count" 201#define K7_KW_EDGE "edge" 202#define K7_KW_INV "inv" 203#define K7_KW_OS "os" 204#define K7_KW_UNITMASK "unitmask" 205#define K7_KW_USR "usr" --- 88 unchanged lines hidden (view full) --- 294 295} 296 297/* 298 * Intel P4 PMCs 299 */ 300 301static struct pmc_event_alias p4_aliases[] = { | 198}; 199 200#define K7_KW_COUNT "count" 201#define K7_KW_EDGE "edge" 202#define K7_KW_INV "inv" 203#define K7_KW_OS "os" 204#define K7_KW_UNITMASK "unitmask" 205#define K7_KW_USR "usr" --- 88 unchanged lines hidden (view full) --- 294 295} 296 297/* 298 * Intel P4 PMCs 299 */ 300 301static struct pmc_event_alias p4_aliases[] = { |
302 EV_ALIAS("cycles", "tsc"), | 302 EV_ALIAS("branches", "p4-branch-retired,mask=mmtp+mmtm"), 303 EV_ALIAS("branch-mispredicts", "p4-mispred-branch-retired"), 304 EV_ALIAS("cycles", "tsc"), 305 EV_ALIAS("instructions", 306 "p4-instr-retired,mask=nbogusntag+nbogustag"), |
303 EV_ALIAS(NULL, NULL) 304}; 305 306#define P4_KW_ACTIVE "active" 307#define P4_KW_ACTIVE_ANY "any" 308#define P4_KW_ACTIVE_BOTH "both" 309#define P4_KW_ACTIVE_NONE "none" 310#define P4_KW_ACTIVE_SINGLE "single" --- 196 unchanged lines hidden (view full) --- 507 508static const struct pmc_masks p4_mask_uqw[] = { /* uop queue writes */ 509 __P4MASK(from-tc-build, 0), 510 __P4MASK(from-tc-deliver, 1), 511 __P4MASK(from-rom, 2), 512 NULLMASK 513}; 514 | 307 EV_ALIAS(NULL, NULL) 308}; 309 310#define P4_KW_ACTIVE "active" 311#define P4_KW_ACTIVE_ANY "any" 312#define P4_KW_ACTIVE_BOTH "both" 313#define P4_KW_ACTIVE_NONE "none" 314#define P4_KW_ACTIVE_SINGLE "single" --- 196 unchanged lines hidden (view full) --- 511 512static const struct pmc_masks p4_mask_uqw[] = { /* uop queue writes */ 513 __P4MASK(from-tc-build, 0), 514 __P4MASK(from-tc-deliver, 1), 515 __P4MASK(from-rom, 2), 516 NULLMASK 517}; 518 |
515static const struct pmc_masks p4_mask_rmbt[] = { /* retired mispred branch type */ | 519static const struct pmc_masks p4_mask_rmbt[] = { 520 /* retired mispred branch type */ |
516 __P4MASK(conditional, 1), 517 __P4MASK(call, 2), 518 __P4MASK(return, 3), 519 __P4MASK(indirect, 4), 520 NULLMASK 521}; 522 523static const struct pmc_masks p4_mask_rbt[] = { /* retired branch type */ --- 373 unchanged lines hidden (view full) --- 897} 898 899/* 900 * Pentium Pro style PMCs. These PMCs are found in Pentium II, Pentium III, 901 * and Pentium M CPUs. 902 */ 903 904static struct pmc_event_alias p6_aliases[] = { | 521 __P4MASK(conditional, 1), 522 __P4MASK(call, 2), 523 __P4MASK(return, 3), 524 __P4MASK(indirect, 4), 525 NULLMASK 526}; 527 528static const struct pmc_masks p4_mask_rbt[] = { /* retired branch type */ --- 373 unchanged lines hidden (view full) --- 902} 903 904/* 905 * Pentium Pro style PMCs. These PMCs are found in Pentium II, Pentium III, 906 * and Pentium M CPUs. 907 */ 908 909static struct pmc_event_alias p6_aliases[] = { |
905EV_ALIAS("branches", "p6-br-inst-retired"), 906EV_ALIAS("branch-mispredicts", "p6-br-miss-pred-retired"), 907EV_ALIAS("cycles", "tsc"), 908EV_ALIAS("instructions", "p6-inst-retired"), 909EV_ALIAS("interrupts", "p6-hw-int-rx"), 910EV_ALIAS(NULL, NULL) | 910 EV_ALIAS("branches", "p6-br-inst-retired"), 911 EV_ALIAS("branch-mispredicts", "p6-br-miss-pred-retired"), 912 EV_ALIAS("cycles", "tsc"), 913 EV_ALIAS("dc-misses", "p6-dcu-lines-in"), 914 EV_ALIAS("ic-misses", "p6-ifu-ifetch-miss"), 915 EV_ALIAS("instructions", "p6-inst-retired"), 916 EV_ALIAS("interrupts", "p6-hw-int-rx"), 917 EV_ALIAS(NULL, NULL) |
911}; 912 913#define P6_KW_CMASK "cmask" 914#define P6_KW_EDGE "edge" 915#define P6_KW_INV "inv" 916#define P6_KW_OS "os" 917#define P6_KW_UMASK "umask" 918#define P6_KW_USR "usr" --- 322 unchanged lines hidden (view full) --- 1241/* 1242 * AMD K8 PMCs. 1243 * 1244 * These are very similar to AMD K7 PMCs, but support more kinds of 1245 * events. 1246 */ 1247 1248static struct pmc_event_alias k8_aliases[] = { | 918}; 919 920#define P6_KW_CMASK "cmask" 921#define P6_KW_EDGE "edge" 922#define P6_KW_INV "inv" 923#define P6_KW_OS "os" 924#define P6_KW_UMASK "umask" 925#define P6_KW_USR "usr" --- 322 unchanged lines hidden (view full) --- 1248/* 1249 * AMD K8 PMCs. 1250 * 1251 * These are very similar to AMD K7 PMCs, but support more kinds of 1252 * events. 1253 */ 1254 1255static struct pmc_event_alias k8_aliases[] = { |
1249 EV_ALIAS("cycles", "tsc"), | 1256 EV_ALIAS("branches", "k8-fr-retired-taken-branches"), 1257 EV_ALIAS("branch-mispredicts", 1258 "k8-fr-retired-taken-branches-mispredicted"), 1259 EV_ALIAS("cycles", "tsc"), 1260 EV_ALIAS("dc-misses", "k8-dc-miss"), 1261 EV_ALIAS("ic-misses", "k8-ic-miss"), 1262 EV_ALIAS("instructions", "k8-fr-retired-x86-instructions"), 1263 EV_ALIAS("interrupts", "k8-fr-taken-hardware-interrupts"), |
1250 EV_ALIAS(NULL, NULL) 1251}; 1252 1253#define __K8MASK(N,V) PMCMASK(N,(1 << (V))) 1254 1255/* 1256 * Parsing tables 1257 */ --- 877 unchanged lines hidden --- | 1264 EV_ALIAS(NULL, NULL) 1265}; 1266 1267#define __K8MASK(N,V) PMCMASK(N,(1 << (V))) 1268 1269/* 1270 * Parsing tables 1271 */ --- 877 unchanged lines hidden --- |