summaryrefslogtreecommitdiffstats
path: root/src/plugins/perfmon/perfmon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/perfmon/perfmon.h')
-rw-r--r--src/plugins/perfmon/perfmon.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h
index f24a23bd974..3d0bc0608f9 100644
--- a/src/plugins/perfmon/perfmon.h
+++ b/src/plugins/perfmon/perfmon.h
@@ -20,6 +20,7 @@
#include <vppinfra/clib.h>
#include <vppinfra/format.h>
#include <vppinfra/error.h>
+#include <vppinfra/cpu.h>
#include <vlib/vlib.h>
#define PERF_MAX_EVENTS 7 /* 3 fixed and 4 programmable */
@@ -32,6 +33,13 @@ typedef enum
PERFMON_BUNDLE_TYPE_SYSTEM,
} perfmon_bundle_type_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;
@@ -61,7 +69,12 @@ typedef struct
} perfmon_instance_type_t;
struct perfmon_source;
-vlib_node_function_t perfmon_dispatch_wrapper;
+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)
typedef clib_error_t *(perfmon_source_init_fn_t) (vlib_main_t *vm,
struct perfmon_source *);
@@ -78,8 +91,10 @@ typedef struct perfmon_source
} perfmon_source_t;
struct perfmon_bundle;
+
typedef clib_error_t *(perfmon_bundle_init_fn_t) (vlib_main_t *vm,
struct perfmon_bundle *);
+
typedef struct perfmon_bundle
{
char *name;
@@ -87,7 +102,9 @@ typedef struct perfmon_bundle
char *source;
char *footer;
perfmon_bundle_type_t type;
+ perfmon_offset_type_t offset_type;
u32 events[PERF_MAX_EVENTS];
+ u32 metrics[PERF_MAX_EVENTS];
u32 n_events;
perfmon_bundle_init_fn_t *init_fn;
@@ -95,6 +112,7 @@ typedef struct perfmon_bundle
char **column_headers;
char **raw_column_headers;
format_function_t *format_fn;
+ clib_cpu_supports_func_t cpu_supports;
/* do not set manually */
perfmon_source_t *src;
@@ -114,7 +132,14 @@ typedef struct
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
u64 n_calls;
u64 n_packets;
- u64 value[PERF_MAX_EVENTS];
+ union
+ {
+ struct
+ {
+ u64 value[PERF_MAX_EVENTS];
+ } t[2];
+ u64 value[PERF_MAX_EVENTS * 2];
+ };
} perfmon_node_stats_t;
typedef struct
@@ -122,6 +147,7 @@ typedef struct
u8 n_events;
u16 n_nodes;
perfmon_node_stats_t *node_stats;
+ perfmon_bundle_t *bundle;
struct perf_event_mmap_page *mmap_pages[PERF_MAX_EVENTS];
} perfmon_thread_runtime_t;