Page MenuHomeFreeBSD

D30528.id90211.diff
No OneTemporary

D30528.id90211.diff

diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c
--- a/lib/libpmc/libpmc_pmu_util.c
+++ b/lib/libpmc/libpmc_pmu_util.c
@@ -542,28 +542,6 @@
return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped));
}
-/*
- * Ultimately rely on AMD calling theirs the same
- */
-static const char *stat_mode_cntrs[] = {
- "cpu_clk_unhalted.thread",
- "inst_retired.any",
- "br_inst_retired.all_branches",
- "br_misp_retired.all_branches",
- "longest_lat_cache.reference",
- "longest_lat_cache.miss",
-};
-
-int
-pmc_pmu_stat_mode(const char ***cntrs)
-{
- if (pmc_pmu_enabled()) {
- *cntrs = stat_mode_cntrs;
- return (0);
- }
- return (EOPNOTSUPP);
-}
-
#else
uint64_t
diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h
--- a/lib/libpmc/pmc.h
+++ b/lib/libpmc/pmc.h
@@ -122,7 +122,6 @@
int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *);
const char *pmc_pmu_event_get_by_idx(const char *, int idx);
int pmc_pmu_idx_get_by_event(const char*, const char *);
-int pmc_pmu_stat_mode(const char ***);
__END_DECLS
#endif
diff --git a/usr.sbin/pmc/cmd_pmc_stat.c b/usr.sbin/pmc/cmd_pmc_stat.c
--- a/usr.sbin/pmc/cmd_pmc_stat.c
+++ b/usr.sbin/pmc/cmd_pmc_stat.c
@@ -104,6 +104,16 @@
"cache-misses",
};
+/* Common aliases for the desired stat counter */
+static const char *pmc_stat_mode_aliases[] = {
+ "unhalted-cycles",
+ "instructions",
+ "branches",
+ "branch-mispredicts",
+ "LLC-REFERENCE",
+ "LLC-MISSES",
+};
+
static int pmcstat_sockpair[NSOCKPAIRFD];
static void __dead2
@@ -153,7 +163,6 @@
pmc_stat_setup_stat(int system_mode, const char *arg)
{
const char *new_cntrs[STAT_MODE_NPMCS];
- static const char **pmc_stat_mode_cntrs;
struct pmcstat_ev *ev;
char *counters, *counter;
int i, c, start, newcnt;
@@ -164,13 +173,11 @@
err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs");
CPU_COPY(&rootmask, &cpumask);
- if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0)
- errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host.");
if (system_mode && geteuid() != 0)
errx(EX_USAGE, "ERROR: system mode counters can only be used as root");
counters = NULL;
for (i = 0; i < STAT_MODE_NPMCS; i++) {
- stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i];
+ stat_mode_cntrs[i] = pmc_stat_mode_aliases[i];
stat_mode_names[i] = pmc_stat_mode_names[i];
}
if (arg) {

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 18, 5:48 PM (17 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27713932
Default Alt Text
D30528.id90211.diff (2 KB)

Event Timeline