libpmc.c (233320) | libpmc.c (233335) |
---|---|
1/*- 2 * Copyright (c) 2003-2008 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-2008 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 233320 2012-03-22 18:07:44Z gonzo $"); | 28__FBSDID("$FreeBSD: head/lib/libpmc/libpmc.c 233335 2012-03-23 00:10:21Z gonzo $"); |
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> --- 110 unchanged lines hidden (view full) --- 147PMC_CLASSDEP_TABLE(iaf, IAF); 148PMC_CLASSDEP_TABLE(k7, K7); 149PMC_CLASSDEP_TABLE(k8, K8); 150PMC_CLASSDEP_TABLE(p4, P4); 151PMC_CLASSDEP_TABLE(p5, P5); 152PMC_CLASSDEP_TABLE(p6, P6); 153PMC_CLASSDEP_TABLE(xscale, XSCALE); 154PMC_CLASSDEP_TABLE(mips24k, MIPS24K); | 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> --- 110 unchanged lines hidden (view full) --- 147PMC_CLASSDEP_TABLE(iaf, IAF); 148PMC_CLASSDEP_TABLE(k7, K7); 149PMC_CLASSDEP_TABLE(k8, K8); 150PMC_CLASSDEP_TABLE(p4, P4); 151PMC_CLASSDEP_TABLE(p5, P5); 152PMC_CLASSDEP_TABLE(p6, P6); 153PMC_CLASSDEP_TABLE(xscale, XSCALE); 154PMC_CLASSDEP_TABLE(mips24k, MIPS24K); |
155PMC_CLASSDEP_TABLE(octeon, OCTEON); |
|
155PMC_CLASSDEP_TABLE(ucf, UCF); 156PMC_CLASSDEP_TABLE(ppc7450, PPC7450); 157 158#undef __PMC_EV_ALIAS 159#define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, 160 161static const struct pmc_event_descr atom_event_table[] = 162{ --- 59 unchanged lines hidden (view full) --- 222PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); 223PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); 224PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); 225PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); 226PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); 227PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); 228PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); 229PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); | 156PMC_CLASSDEP_TABLE(ucf, UCF); 157PMC_CLASSDEP_TABLE(ppc7450, PPC7450); 158 159#undef __PMC_EV_ALIAS 160#define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, 161 162static const struct pmc_event_descr atom_event_table[] = 163{ --- 59 unchanged lines hidden (view full) --- 223PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); 224PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); 225PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); 226PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); 227PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); 228PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); 229PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); 230PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); |
231PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); |
|
230PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); 231 232static const struct pmc_event_descr tsc_event_table[] = 233{ 234 __PMC_EV_TSC() 235}; 236 237#undef PMC_CLASS_TABLE_DESC --- 37 unchanged lines hidden (view full) --- 275PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc); 276#endif 277#if defined(__XSCALE__) 278PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); 279#endif 280 281#if defined(__mips__) 282PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); | 232PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); 233 234static const struct pmc_event_descr tsc_event_table[] = 235{ 236 __PMC_EV_TSC() 237}; 238 239#undef PMC_CLASS_TABLE_DESC --- 37 unchanged lines hidden (view full) --- 277PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc); 278#endif 279#if defined(__XSCALE__) 280PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); 281#endif 282 283#if defined(__mips__) 284PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); |
285PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); |
|
283#endif /* __mips__ */ 284 285#if defined(__powerpc__) 286PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); 287#endif 288 289#undef PMC_CLASS_TABLE_DESC 290 --- 1912 unchanged lines hidden (view full) --- 2203 2204static struct pmc_event_alias mips24k_aliases[] = { 2205 EV_ALIAS("instructions", "INSTR_EXECUTED"), 2206 EV_ALIAS("branches", "BRANCH_COMPLETED"), 2207 EV_ALIAS("branch-mispredicts", "BRANCH_MISPRED"), 2208 EV_ALIAS(NULL, NULL) 2209}; 2210 | 286#endif /* __mips__ */ 287 288#if defined(__powerpc__) 289PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); 290#endif 291 292#undef PMC_CLASS_TABLE_DESC 293 --- 1912 unchanged lines hidden (view full) --- 2206 2207static struct pmc_event_alias mips24k_aliases[] = { 2208 EV_ALIAS("instructions", "INSTR_EXECUTED"), 2209 EV_ALIAS("branches", "BRANCH_COMPLETED"), 2210 EV_ALIAS("branch-mispredicts", "BRANCH_MISPRED"), 2211 EV_ALIAS(NULL, NULL) 2212}; 2213 |
2214static struct pmc_event_alias octeon_aliases[] = { 2215 EV_ALIAS("instructions", "RET"), 2216 EV_ALIAS("branches", "BR"), 2217 EV_ALIAS("branch-mispredicts", "BRMIS"), 2218 EV_ALIAS(NULL, NULL) 2219}; 2220 |
|
2211#define MIPS_KW_OS "os" 2212#define MIPS_KW_USR "usr" 2213#define MIPS_KW_ANYTHREAD "anythread" 2214 2215static int 2216mips_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, 2217 struct pmc_op_pmcallocate *pmc_config __unused) 2218{ --- 421 unchanged lines hidden (view full) --- 2640 case PMC_CLASS_XSCALE: 2641 ev = xscale_event_table; 2642 count = PMC_EVENT_TABLE_SIZE(xscale); 2643 break; 2644 case PMC_CLASS_MIPS24K: 2645 ev = mips24k_event_table; 2646 count = PMC_EVENT_TABLE_SIZE(mips24k); 2647 break; | 2221#define MIPS_KW_OS "os" 2222#define MIPS_KW_USR "usr" 2223#define MIPS_KW_ANYTHREAD "anythread" 2224 2225static int 2226mips_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, 2227 struct pmc_op_pmcallocate *pmc_config __unused) 2228{ --- 421 unchanged lines hidden (view full) --- 2650 case PMC_CLASS_XSCALE: 2651 ev = xscale_event_table; 2652 count = PMC_EVENT_TABLE_SIZE(xscale); 2653 break; 2654 case PMC_CLASS_MIPS24K: 2655 ev = mips24k_event_table; 2656 count = PMC_EVENT_TABLE_SIZE(mips24k); 2657 break; |
2658 case PMC_CLASS_OCTEON: 2659 ev = octeon_event_table; 2660 count = PMC_EVENT_TABLE_SIZE(octeon); 2661 break; |
|
2648 case PMC_CLASS_PPC7450: 2649 ev = ppc7450_event_table; 2650 count = PMC_EVENT_TABLE_SIZE(ppc7450); 2651 break; 2652 default: 2653 errno = EINVAL; 2654 return (-1); 2655 } --- 203 unchanged lines hidden (view full) --- 2859 pmc_class_table[n] = &xscale_class_table_descr; 2860 break; 2861#endif 2862#if defined(__mips__) 2863 case PMC_CPU_MIPS_24K: 2864 PMC_MDEP_INIT(mips24k); 2865 pmc_class_table[n] = &mips24k_class_table_descr; 2866 break; | 2662 case PMC_CLASS_PPC7450: 2663 ev = ppc7450_event_table; 2664 count = PMC_EVENT_TABLE_SIZE(ppc7450); 2665 break; 2666 default: 2667 errno = EINVAL; 2668 return (-1); 2669 } --- 203 unchanged lines hidden (view full) --- 2873 pmc_class_table[n] = &xscale_class_table_descr; 2874 break; 2875#endif 2876#if defined(__mips__) 2877 case PMC_CPU_MIPS_24K: 2878 PMC_MDEP_INIT(mips24k); 2879 pmc_class_table[n] = &mips24k_class_table_descr; 2880 break; |
2881 case PMC_CPU_MIPS_OCTEON: 2882 PMC_MDEP_INIT(octeon); 2883 pmc_class_table[n] = &octeon_class_table_descr; 2884 break; |
|
2867#endif /* __mips__ */ 2868#if defined(__powerpc__) 2869 case PMC_CPU_PPC_7450: 2870 PMC_MDEP_INIT(ppc7450); 2871 pmc_class_table[n] = &ppc7450_class_table_descr; 2872 break; 2873#endif 2874 default: --- 139 unchanged lines hidden (view full) --- 3014 evfence = p6_event_table + PMC_EVENT_TABLE_SIZE(p6); 3015 } else if (pe >= PMC_EV_XSCALE_FIRST && pe <= PMC_EV_XSCALE_LAST) { 3016 ev = xscale_event_table; 3017 evfence = xscale_event_table + PMC_EVENT_TABLE_SIZE(xscale); 3018 } else if (pe >= PMC_EV_MIPS24K_FIRST && pe <= PMC_EV_MIPS24K_LAST) { 3019 ev = mips24k_event_table; 3020 evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k 3021); | 2885#endif /* __mips__ */ 2886#if defined(__powerpc__) 2887 case PMC_CPU_PPC_7450: 2888 PMC_MDEP_INIT(ppc7450); 2889 pmc_class_table[n] = &ppc7450_class_table_descr; 2890 break; 2891#endif 2892 default: --- 139 unchanged lines hidden (view full) --- 3032 evfence = p6_event_table + PMC_EVENT_TABLE_SIZE(p6); 3033 } else if (pe >= PMC_EV_XSCALE_FIRST && pe <= PMC_EV_XSCALE_LAST) { 3034 ev = xscale_event_table; 3035 evfence = xscale_event_table + PMC_EVENT_TABLE_SIZE(xscale); 3036 } else if (pe >= PMC_EV_MIPS24K_FIRST && pe <= PMC_EV_MIPS24K_LAST) { 3037 ev = mips24k_event_table; 3038 evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k 3039); |
3040 } else if (pe >= PMC_EV_OCTEON_FIRST && pe <= PMC_EV_OCTEON_LAST) { 3041 ev = octeon_event_table; 3042 evfence = octeon_event_table + PMC_EVENT_TABLE_SIZE(octeon); |
|
3022 } else if (pe >= PMC_EV_PPC7450_FIRST && pe <= PMC_EV_PPC7450_LAST) { 3023 ev = ppc7450_event_table; 3024 evfence = ppc7450_event_table + PMC_EVENT_TABLE_SIZE(ppc7450 3025); 3026 } else if (pe == PMC_EV_TSC_TSC) { 3027 ev = tsc_event_table; 3028 evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc); 3029 } --- 203 unchanged lines hidden --- | 3043 } else if (pe >= PMC_EV_PPC7450_FIRST && pe <= PMC_EV_PPC7450_LAST) { 3044 ev = ppc7450_event_table; 3045 evfence = ppc7450_event_table + PMC_EVENT_TABLE_SIZE(ppc7450 3046); 3047 } else if (pe == PMC_EV_TSC_TSC) { 3048 ev = tsc_event_table; 3049 evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc); 3050 } --- 203 unchanged lines hidden --- |