diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2024-05-16 21:00:51 -0700 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2024-05-17 18:28:05 -0700 |
commit | ee7af0e7107e918d37bd2686fea1db8f88d2242a (patch) | |
tree | 12897d98828474dcde1099595921b4e344305bea /gprofng/common/hwcdrv.h | |
parent | 663741df74f975ca00de84ba17d2cd8417bb1d03 (diff) | |
download | binutils-ee7af0e7107e918d37bd2686fea1db8f88d2242a.zip binutils-ee7af0e7107e918d37bd2686fea1db8f88d2242a.tar.gz binutils-ee7af0e7107e918d37bd2686fea1db8f88d2242a.tar.bz2 |
gprofng: add hardware counters for AMD Zen3
Historically, we have used several APIs (perfctr, libcpc, perf_event_open) for profiling.
For each hardware we have several tables of hardware counters.
Some information is duplicated in these tables.
Some of the information is no longer used.
I did not touch the existing hwc tables.
I added a new hwc table for an AMD Zen3 machine.
ChangeLog
2024-05-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/31123
* common/core_pcbe.c (core_pcbe_get_events): Add new argument.
* common/hwc_cpus.h: New constants for AMD hardware.
* common/hwcdrv.c: Add new argument to hwcdrv_get_descriptions.
Clean up the code.
* common/hwcdrv.h: Likewise.
* common/hwcfuncs.c (hwcdrv_get_descriptions): Add new argument.
* common/hwctable.c: Add the hwc table for AMD Zen3.
* src/hwc_amd_zen3.h: New file.
* common/opteron_pcbe.c: Add new argument to opt_pcbe_get_events.
* src/collctrl.cc: Remove unused variable.
* src/collctrl.h: Likewise.
Diffstat (limited to 'gprofng/common/hwcdrv.h')
-rw-r--r-- | gprofng/common/hwcdrv.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/gprofng/common/hwcdrv.h b/gprofng/common/hwcdrv.h index 0a5eb33..fb97c8a 100644 --- a/gprofng/common/hwcdrv.h +++ b/gprofng/common/hwcdrv.h @@ -126,11 +126,13 @@ extern "C" */ int (*hwcdrv_get_descriptions)(hwcf_hwc_cb_t *hwc_find_action, - hwcf_attr_cb_t *attr_find_action); - /* Initiate callbacks with all available HWC names and and HWC attributes. + hwcf_attr_cb_t *attr_find_action, + Hwcentry *raw_hwc_tbl); + /* Initiate callbacks with all available HWC names and HWC attributes. Input: <hwc_find_action>: if not NULL, will be called once for each HWC <attr_find_action>: if not NULL, will be called once for each attribute + <raw_hwc_tbl>: counter definitions. Return: 0 if successful or a cpc return code upon error */ @@ -260,15 +262,6 @@ extern "C" ( (((eventsel_t)(evnum) & 0x0f00ULL) << 24) | ((eventsel_t)(evnum) & ~0x0f00ULL) ) typedef uint64_t eventsel_t; - extern int hwcfuncs_get_x86_eventsel (unsigned int regno, const char *int_name, - eventsel_t *return_event, uint_t *return_pmc_sel); - - typedef int (hwcdrv_get_events_fn_t) (hwcf_hwc_cb_t *hwc_cb); - typedef int (hwcdrv_get_eventnum_fn_t) (const char *eventname, uint_t pmc, - eventsel_t *eventnum, - eventsel_t *valid_umask, uint_t *pmc_sel); - extern hwcdrv_get_eventnum_fn_t *hwcdrv_get_x86_eventnum; - typedef struct { const char * attrname; // user-visible name of attribute @@ -285,7 +278,7 @@ extern "C" uint_t (*hdrv_pcbe_ncounters)(void); const char *(*hdrv_pcbe_impl_name)(void); const char *(*hdrv_pcbe_cpuref)(void); - int (*hdrv_pcbe_get_events)(hwcf_hwc_cb_t *hwc_cb); + int (*hdrv_pcbe_get_events)(hwcf_hwc_cb_t *hwc_cb, Hwcentry *raw_hwc_tbl); int (*hdrv_pcbe_get_eventnum)(const char * eventname, uint_t pmc, eventsel_t *eventnum, eventsel_t *valid_umask, uint_t *pmc_sel); |