summaryrefslogtreecommitdiffstats
path: root/lib/libpmc
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-04-20 20:48:24 +0000
committermarcel <marcel@FreeBSD.org>2005-04-20 20:48:24 +0000
commit24142cab5d6d12a58fb1fd6d8426f8b5c95f3113 (patch)
tree1117f52c258739adba29285c7dd4bd7086eb3060 /lib/libpmc
parentdd5b3be596de3dc8fd4563818e40e186501034a1 (diff)
downloadFreeBSD-src-24142cab5d6d12a58fb1fd6d8426f8b5c95f3113.zip
FreeBSD-src-24142cab5d6d12a58fb1fd6d8426f8b5c95f3113.tar.gz
o Do not include <machine/pmc_mdep.h>. It's automaticly included for
us when <sys/pmc.h> is included. o Replace "#if __i386__" and "#if __amd64__" with the equivalent of "#ifdef __i386__" and "#ifdef __amd64__" (resp.) These tokens are not defined on all platforms. o Conditionally compile pmc_parse_mask() on i386 and amd64 only. It's only referenced there. This will change when support for other platforms is added, of course. Ok'd by: jkoshy@
Diffstat (limited to 'lib/libpmc')
-rw-r--r--lib/libpmc/libpmc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 237641b..9a46586 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$");
#include <sys/pmc.h>
#include <sys/syscall.h>
-#include <machine/pmc_mdep.h>
-
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -45,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
/* Function prototypes */
-#if __i386__
+#if defined(__i386__)
static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
struct pmc_op_pmcallocate *_pmc_config);
static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
@@ -54,7 +52,7 @@ static int p4_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
struct pmc_op_pmcallocate *_pmc_config);
static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
struct pmc_op_pmcallocate *_pmc_config);
-#elif __amd64__
+#elif defined(__amd64__)
static int k8_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
struct pmc_op_pmcallocate *_pmc_config);
#endif
@@ -152,6 +150,7 @@ struct pmc_masks {
#define PMCMASK(N,V) { .pm_name = #N, .pm_value = (V) }
#define NULLMASK PMCMASK(NULL,0)
+#if defined(__i386__) || defined(__amd64__)
static int
pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask)
{
@@ -175,12 +174,13 @@ pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask)
}
return c;
}
+#endif
#define KWMATCH(p,kw) (strcasecmp((p), (kw)) == 0)
#define KWPREFIXMATCH(p,kw) (strncasecmp((p), (kw), sizeof((kw)) - 1) == 0)
#define EV_ALIAS(N,S) { .pm_alias = N, .pm_spec = S }
-#if __i386__
+#if defined(__i386__)
/*
* AMD K7 (Athlon) CPUs.
@@ -1236,7 +1236,7 @@ p5_allocate_pmc(enum pmc_event pe, char *ctrspec,
return -1 || pe || ctrspec || pmc_config; /* shut up gcc */
}
-#elif __amd64__
+#elif defined(__amd64__)
/*
* AMD K8 PMCs.
@@ -1634,7 +1634,7 @@ pmc_init(void)
/* set parser pointer */
switch (cpu_info.pm_cputype) {
-#if __i386__
+#if defined(__i386__)
case PMC_CPU_AMD_K7:
pmc_mdep_event_aliases = k7_aliases;
pmc_mdep_allocate_pmc = k7_allocate_pmc;
@@ -1654,7 +1654,7 @@ pmc_init(void)
pmc_mdep_event_aliases = p4_aliases;
pmc_mdep_allocate_pmc = p4_allocate_pmc;
break;
-#elif __amd64__
+#elif defined(__amd64__)
case PMC_CPU_AMD_K8:
pmc_mdep_event_aliases = k8_aliases;
pmc_mdep_allocate_pmc = k8_allocate_pmc;
@@ -2117,7 +2117,7 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames,
* Architecture specific APIs
*/
-#if __i386__ || __amd64__
+#if defined(__i386__) || defined(__amd64__)
int
pmc_x86_get_msr(pmc_id_t pmc, uint32_t *msr)
OpenPOWER on IntegriCloud