From 6c81f5a2493ff65b4dacfef45db8a1ee459a738f Mon Sep 17 00:00:00 2001 From: Tom Seidenberg Date: Fri, 10 Jul 2020 15:49:03 +0000 Subject: misc: add callback hooks and refactor pmc Callbacks for monitoring and performance measurement: - Add new callback list type, with context - Add callbacks for API, CLI, and barrier sync - Modify node dispatch callback to pass plugin-specific context - Modify perfmon plugin to keep PMC samples local to the plugin - Include process nodes in dispatch callback - Pass dispatch function return value to callback Type: refactor Signed-off-by: Tom Seidenberg Change-Id: I28b06c58490611e08d76ff5b01b2347ba2109b22 --- src/plugins/perfmon/perfmon.h | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'src/plugins/perfmon/perfmon.h') diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h index 000e3c2849c..c8782023597 100644 --- a/src/plugins/perfmon/perfmon.h +++ b/src/plugins/perfmon/perfmon.h @@ -76,6 +76,32 @@ typedef struct u8 *value; } name_value_pair_t; +typedef struct +{ + u64 ticks[2]; + u64 vectors; +} perfmon_counters_t; + +typedef struct +{ + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); + + /* Current counters */ + u64 c[2]; + + /* Current perf_event file descriptors, per thread */ + int pm_fds[2]; + + /* mmap base of mapped struct perf_event_mmap_page */ + u8 *perf_event_pages[2]; + + u32 rdpmc_indices[2]; + + /* vector of counters by node index */ + perfmon_counters_t *counters; + +} perfmon_thread_t; + typedef struct { /* API message ID base */ @@ -112,17 +138,15 @@ typedef struct /* Current event (index) being collected */ u32 current_event; int n_active; - u32 **rdpmc_indices; - /* mmap base / size of (mapped) struct perf_event_mmap_page */ - u8 ***perf_event_pages; + /* mmap size of (mapped) struct perf_event_mmap_page */ u32 page_size; - /* Current perf_event file descriptors, per thread */ - int **pm_fds; - /* thread bitmap */ uword *thread_bitmap; + /* per-thread data */ + perfmon_thread_t **threads; + /* Logging */ vlib_log_class_t log_class; @@ -137,6 +161,8 @@ extern perfmon_main_t perfmon_main; extern vlib_node_registration_t perfmon_periodic_node; uword *perfmon_parse_table (perfmon_main_t * pm, char *path, char *filename); +uword unformat_processor_event (unformat_input_t * input, va_list * args); + /* Periodic function events */ #define PERFMON_START 1 -- cgit 1.2.3-korg