summaryrefslogtreecommitdiffstats
path: root/src/plugins/perfmon/intel/uncore.c
diff options
context:
space:
mode:
authorRay Kinsella <mdr@ashroe.eu>2021-11-02 13:41:06 +0000
committerDamjan Marion <dmarion@me.com>2021-11-02 22:25:40 +0000
commit63081acb3ff02d5d60e971943d03b8c9abeaae00 (patch)
tree374902edafcc33cd7d8feb252f34087ece82dc5d /src/plugins/perfmon/intel/uncore.c
parent5714a49f14b93fc51185c6d37af101d24fc5dbd2 (diff)
perfmon: added intel internal io pmu support
Added support for the Intel Internal IO Uncore PMU, along with the ability to format PMU Unit specific names. Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I2939f8ade5e5ed63ccf7f3ccd0279d7c72e95a6e
Diffstat (limited to 'src/plugins/perfmon/intel/uncore.c')
-rw-r--r--src/plugins/perfmon/intel/uncore.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/plugins/perfmon/intel/uncore.c b/src/plugins/perfmon/intel/uncore.c
index ee3e4aea630..ec31fac75c0 100644
--- a/src/plugins/perfmon/intel/uncore.c
+++ b/src/plugins/perfmon/intel/uncore.c
@@ -35,10 +35,16 @@ VLIB_REGISTER_LOG_CLASS (if_intel_uncore_log, static) = {
((event) | (umask) << 8 | (edge) << 18 | (any) << 21 | (inv) << 23 | \
(cmask) << 24)
+static intel_uncore_unit_type_names_t uncore_unit_names[] = {
+ { INTEL_UNCORE_UNIT_IIO,
+ PERFMON_STRINGS ("PCIe0", "PCIe1", "MCP", "PCIe2", "PCIe3", "CBDMA/DMI") }
+};
+
static perfmon_event_t intel_uncore_events[] = {
-#define _(unit, event, umask, n, suffix, desc) \
+#define _(unit, event, umask, ch_mask, fc_mask, n, suffix, desc) \
[INTEL_UNCORE_E_##unit##_##n##_##suffix] = { \
- .config = (event) | (umask) << 8, \
+ .config = \
+ (event) | (umask) << 8 | (u64) (ch_mask) << 36 | (u64) (fc_mask) << 48, \
.name = #n "." #suffix, \
.description = desc, \
.type_from_instance = 1, \
@@ -57,6 +63,32 @@ intel_uncore_instance_name_cmp (void *v1, void *v2)
return strcmp (i1->name, i2->name);
}
+static_always_inline u8 *
+format_instance_name (intel_uncore_unit_type_t u, char *unit_fmt, u8 socket_id,
+ u8 ubox)
+{
+ u8 *s = 0;
+
+ /* uncore ubox may have specific names */
+ for (u8 i = 0; i < ARRAY_LEN (uncore_unit_names); i++)
+ {
+ intel_uncore_unit_type_names_t *n = &uncore_unit_names[i];
+
+ if (n->unit_type == u)
+ {
+ u8 *fmt = 0;
+
+ fmt = format (0, "%s (%s)", unit_fmt, (n->unit_names[ubox]));
+ s = format (0, (char *) fmt, socket_id, ubox);
+ vec_free (fmt);
+
+ return s;
+ }
+ }
+
+ return format (0, unit_fmt, socket_id, ubox);
+}
+
static void
intel_uncore_add_unit (perfmon_source_t *src, intel_uncore_unit_type_t u,
char *name, char *type_str, char *fmt,
@@ -94,7 +126,8 @@ intel_uncore_add_unit (perfmon_source_t *src, intel_uncore_unit_type_t u,
in->type = perf_type;
in->cpu = j;
in->pid = -1;
- in->name = (char *) format (0, fmt, socket_by_cpu_id[j], i);
+ in->name =
+ (char *) format_instance_name (u, fmt, socket_by_cpu_id[j], i);
vec_terminate_c_string (in->name);
log_debug ("found %s %s", type_str, in->name);
}