Forcing a AMD64 pmu can now be done by specifying a certain family, model and stepping. The syntax of the environment variable for this has been extended:
LIBPFM_FORCE_PMU=16,<family>,<model>,<stepping> Signed-off-by: Robert Richter <robert.rich...@amd.com> --- lib/pfmlib_amd64.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/pfmlib_amd64.c b/lib/pfmlib_amd64.c index f8bee8c..242fbc1 100644 --- a/lib/pfmlib_amd64.c +++ b/lib/pfmlib_amd64.c @@ -236,18 +236,47 @@ pfm_amd64_detect(void) return PFMLIB_SUCCESS; } +static void +pfm_amd64_force(void) +{ + char *str; + int pmu_type; + + /* parses LIBPFM_FORCE_PMU=16,<family>,<model>,<stepping> */ + str = getenv("LIBPFM_FORCE_PMU"); + if (!str) + goto failed; + pmu_type = strtol(str, &str, 10); + if (pmu_type != 16) + goto failed; + if (!*str || *str++ != ',') + goto failed; + amd64_family = strtol(str, &str, 10); + if (!*str || *str++ != ',') + goto failed; + amd64_model = strtol(str, &str, 10); + if (!*str || *str++ != ',') + goto failed; + amd64_stepping = strtol(str, &str, 10); + if (!*str) + goto done; +failed: + DPRINT("force failed at: %s\n", str ? str : "<NULL>"); + /* force AMD64 = force to Barcelona */ + amd64_family = 16; + amd64_model = 2; + amd64_stepping = 2; +done: + amd64_revision = amd64_get_revision(amd64_family, amd64_model, + amd64_stepping); +} + static int pfm_amd64_init(void) { - /* - * force AMD64 = force to Barcelona - */ - if (forced_pmu != PFMLIB_NO_PMU) { - amd64_family = 16; - amd64_model = 2; - amd64_stepping = 2; - amd64_revision = amd64_get_revision(amd64_family, amd64_model, amd64_stepping); - } + if (forced_pmu != PFMLIB_NO_PMU) + pfm_amd64_force(); + __pfm_vbprintf("AMD family=%d model=0x%x stepping=0x%x rev=%s (%s)\n", amd64_family, amd64_model, -- 1.6.1.2 ------------------------------------------------------------------------------ _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel