diff options
author | Ray Kinsella <mdr@ashroe.eu> | 2021-09-07 16:26:58 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-09-08 14:30:03 +0000 |
commit | c3cb2075deef7cd35401f9d2f00f3aeb23ed16d5 (patch) | |
tree | a87cb337cd8e41487e76ed6939dd38545089decf /src/plugins/perfmon/perfmon.h | |
parent | 6f98d9900d1c35292be94307724c6c897c24dfe2 (diff) |
perfmon: adding support for papi TMAM
Adding support for Linux papi TMAM on Intel Snowridge. Adds the ability to
indicate that a bundle should be thread or node bundle type based on available
cpu features (rdpmc support).
Type: feature
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: Ib871b2644fdb2410fbb580e0d21c3a8e2be13aba
Diffstat (limited to 'src/plugins/perfmon/perfmon.h')
-rw-r--r-- | src/plugins/perfmon/perfmon.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h index bba22cf6b1d..967b92e0e4a 100644 --- a/src/plugins/perfmon/perfmon.h +++ b/src/plugins/perfmon/perfmon.h @@ -31,6 +31,7 @@ typedef enum PERFMON_BUNDLE_TYPE_NODE, PERFMON_BUNDLE_TYPE_THREAD, PERFMON_BUNDLE_TYPE_SYSTEM, + PERFMON_BUNDLE_TYPE_MAX, } perfmon_bundle_type_t; typedef enum @@ -95,6 +96,12 @@ struct perfmon_bundle; typedef clib_error_t *(perfmon_bundle_init_fn_t) (vlib_main_t *vm, struct perfmon_bundle *); +typedef struct +{ + clib_cpu_supports_func_t cpu_supports; + perfmon_bundle_type_t bundle_type; +} perfmon_cpu_supports_t; + typedef struct perfmon_bundle { char *name; @@ -104,14 +111,18 @@ typedef struct perfmon_bundle perfmon_bundle_type_t type; perfmon_offset_type_t offset_type; u32 events[PERF_MAX_EVENTS]; - u32 metrics[PERF_MAX_EVENTS]; u32 n_events; + u32 metrics[PERF_MAX_EVENTS]; + u32 n_metrics; + + perfmon_cpu_supports_t *cpu_supports; + u32 n_cpu_supports; + perfmon_bundle_init_fn_t *init_fn; char **column_headers; format_function_t *format_fn; - clib_cpu_supports_func_t cpu_supports; /* do not set manually */ perfmon_source_t *src; @@ -168,6 +179,24 @@ typedef struct extern perfmon_main_t perfmon_main; +always_inline uword +perfmon_cpu_supported_bundle_type (perfmon_bundle_t *b) +{ + perfmon_cpu_supports_t *supports = b->cpu_supports; + uword type = 0; + + /* if nothing specific for this bundle, go with the default */ + if (!supports) + return b->type; + + /* the last specified type, will always win */ + for (int i = 0; i < b->n_cpu_supports; ++i) + if (supports[i].cpu_supports ()) + type = supports[i].bundle_type; + + return type; +} + #define PERFMON_REGISTER_SOURCE(x) \ perfmon_source_t __perfmon_source_##x; \ static void __clib_constructor __perfmon_source_registration_##x (void) \ @@ -184,6 +213,8 @@ extern perfmon_main_t perfmon_main; { \ perfmon_main_t *pm = &perfmon_main; \ __perfmon_bundle_##x.next = pm->bundles; \ + __perfmon_bundle_##x.type = \ + perfmon_cpu_supported_bundle_type (&__perfmon_bundle_##x); \ pm->bundles = &__perfmon_bundle_##x; \ } \ perfmon_bundle_t __perfmon_bundle_##x |