From 8fe04eeb2cbb8c4cf7b6e8d9183fe09a8b2e8d51 Mon Sep 17 00:00:00 2001 From: Vladimir Mezentsev Date: Mon, 8 Jan 2024 22:00:24 -0800 Subject: gprofng: 31123 improvements to hardware event implementation Our hardware counter profiling is based on perf_event_open(). Our HWC tables are absent for new machines. I have added HWC tables for the following events: PERF_TYPE_HARDWARE, PERF_TYPE_SOFTWARE, PERF_TYPE_HW_CACHE. Other events require additional fixes. Did a little cleaning: marked the symbols as static, used Stringbuilder, created a function to read /proc/cpuinfo. gprofng/ChangeLog 2024-01-08 Vladimir Mezentsev PR gprofng/31123 * common/core_pcbe.c: Mark the symbols as static. Add events_generic[]. * common/hwc_cpus.h: Declare a new function read_cpuinfo. * common/hwcdrv.c: Add a new parameter in init_perf_event(). * common/hwcentry.h: Add use_perf_event_type in Hwcentry. * common/hwcfuncs.c (process_data_descriptor): Read use_perf_event_type, type, config. * common/hwctable.c: Add a new HWC table generic_list[]. * common/opteron_pcbe.c (opt_pcbe_init): Accept AMD machines. * src/collctrl.cc: Use StringBuilder in Coll_Ctrl::build_data_desc(). Add a new function read_cpuinfo. --- gprofng/common/hwcentry.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gprofng/common/hwcentry.h') diff --git a/gprofng/common/hwcentry.h b/gprofng/common/hwcentry.h index 739bc4e..a35a363 100644 --- a/gprofng/common/hwcentry.h +++ b/gprofng/common/hwcentry.h @@ -112,11 +112,12 @@ extern "C" int timecvt; /* multiplier to convert metric to time, 0 if N/A */ ABST_type memop; /* type of backtracking allowed */ char *short_desc; /* optional one-liner description, or NULL */ - int type; /* Type of perf_event_attr */ - long long config; /* perf_event_type -specific configuration */ /* the fields above this line are expected, in order, by the tables in hwctable.c */ /* ================================================== */ /* the fields below this line are more flexible */ + unsigned int use_perf_event_type : 16; /* Set 1 to use two fields below */ + unsigned int type : 16; /* Type of perf_event_attr */ + long long config; /* perf_event_type -specific configuration */ int sort_order; /* "tag" to associate experiment record with HWC def */ regno_t *reg_list; /* if not NULL, legal values for field above */ /* Note: reg_list will be terminated by REGNO_ANY */ -- cgit v1.1