diff options
author | Ray Kinsella <mdr@ashroe.eu> | 2021-12-02 08:06:01 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-12-02 15:02:39 +0000 |
commit | e893beab2713a7fa1b8d5e9567b7c004e625fec6 (patch) | |
tree | b8a2fac3a3fd8645c188279f989444982d9602f4 /src/plugins/perfmon/perfmon.h | |
parent | c30f3006bde0005962edf4cf84ca022b806b5ccf (diff) |
perfmon: refactor perf metric support
Refactoring perf metric support to remove branching on bundle type in
the dispatch wrapper. This change includes caching the rdpmc index at
perfmon_start(), so that the mmap_page.index doesn't need to be looked
up each time. It also exclude the effects of mmap_page.index.
This patch prepares the path for bundles that support general, fixed and
metrics counters simulataneously.
Type: refactor
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: I9c5b4917bd02fea960e546e8558452c4362eabc4
Diffstat (limited to 'src/plugins/perfmon/perfmon.h')
-rw-r--r-- | src/plugins/perfmon/perfmon.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h index 0b46e524369..5003e59015e 100644 --- a/src/plugins/perfmon/perfmon.h +++ b/src/plugins/perfmon/perfmon.h @@ -49,13 +49,6 @@ typedef enum } perfmon_bundle_type_flag_t; -typedef enum -{ - PERFMON_OFFSET_TYPE_MMAP, - PERFMON_OFFSET_TYPE_METRICS, - PERFMON_OFFSET_TYPE_MAX, -} perfmon_offset_type_t; - typedef struct { u32 type_from_instance : 1; @@ -85,12 +78,7 @@ typedef struct } perfmon_instance_type_t; struct perfmon_source; -vlib_node_function_t perfmon_dispatch_wrapper_mmap; -vlib_node_function_t perfmon_dispatch_wrapper_metrics; - -#define foreach_permon_offset_type \ - _ (PERFMON_OFFSET_TYPE_MMAP, perfmon_dispatch_wrapper_mmap) \ - _ (PERFMON_OFFSET_TYPE_METRICS, perfmon_dispatch_wrapper_metrics) +vlib_node_function_t perfmon_dispatch_wrapper; typedef clib_error_t *(perfmon_source_init_fn_t) (vlib_main_t *vm, struct perfmon_source *); @@ -131,12 +119,10 @@ typedef struct perfmon_bundle }; perfmon_bundle_type_t active_type; - perfmon_offset_type_t offset_type; u32 events[PERF_MAX_EVENTS]; u32 n_events; - u32 metrics[PERF_MAX_EVENTS]; - u32 n_metrics; + u16 preserve_samples; perfmon_cpu_supports_t *cpu_supports; u32 n_cpu_supports; @@ -180,6 +166,8 @@ typedef struct u16 n_nodes; perfmon_node_stats_t *node_stats; perfmon_bundle_t *bundle; + u32 indexes[PERF_MAX_EVENTS]; + u16 preserve_samples; struct perf_event_mmap_page *mmap_pages[PERF_MAX_EVENTS]; } perfmon_thread_runtime_t; |