18 #include <perfmon/perfmon.h> 23 .class_name =
"perfmon",
24 .subclass_name =
"intel-uncore",
27 #define log_debug(fmt, ...) \ 28 vlib_log_debug (if_intel_uncore_log.class, fmt, __VA_ARGS__) 29 #define log_warn(fmt, ...) \ 30 vlib_log_warn (if_intel_uncore_log.class, fmt, __VA_ARGS__) 31 #define log_err(fmt, ...) \ 32 vlib_log_err (if_intel_uncore_log.class, fmt, __VA_ARGS__) 34 #define PERF_INTEL_CODE(event, umask, edge, any, inv, cmask) \ 35 ((event) | (umask) << 8 | (edge) << 18 | (any) << 21 | (inv) << 23 | \ 39 #define _(unit, event, umask, n, suffix, desc) \ 40 [INTEL_UNCORE_E_##unit##_##n##_##suffix] = { \ 41 .config = (event) | (umask) << 8, \ 42 .name = #n "." #suffix, \ 43 .description = desc, \ 44 .type_from_instance = 1, \ 45 .instance_type = INTEL_UNCORE_UNIT_##unit, \ 62 char *
name,
char *type_str,
char *
fmt,
63 int *socket_by_cpu_id)
65 static char *base_path =
"/sys/bus/event_source/devices/uncore";
80 s =
format (s,
"%s_%s_%u/type%c", base_path, name, i, 0);
85 s =
format (s,
"%s_%s_%u/cpumask%c", base_path, name, i, 0);
97 in->
name = (
char *)
format (0, fmt, socket_by_cpu_id[j], i);
113 int *numa_by_cpu_id = 0;
126 s =
format (s,
"/sys/devices/system/node/node%u/cpulist%c", i, 0);
138 numa_by_cpu_id[j] =
i;
144 #define _(t, n, name, fmt) \ 145 intel_uncore_add_unit (src, INTEL_UNCORE_UNIT_##t, n, name, fmt, \ 176 .name =
"intel-uncore",
177 .description =
"intel uncore events",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_intel_uncore_unit_type
#define foreach_intel_uncore_event
perfmon_instance_t * instances
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static int intel_uncore_instance_name_cmp(void *v1, void *v2)
description fragment has unexpected format
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
PERFMON_REGISTER_SOURCE(intel_uncore)
static perfmon_event_t intel_uncore_events[]
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static clib_error_t * intel_uncore_init(vlib_main_t *vm, perfmon_source_t *src)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
__clib_export uword unformat_bitmap_list(unformat_input_t *input, va_list *va)
unformat a list of bit ranges into a bitmap (eg "0-3,5-7,11" )
format_function_t format_intel_core_config
perfmon_instance_type_t * instances_by_type
#define clib_bitmap_free(v)
Free a bitmap.
#define log_debug(fmt,...)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define clib_error_free(e)
__clib_export clib_error_t * clib_sysfs_read(char *file_name, char *fmt,...)
static void intel_uncore_add_unit(perfmon_source_t *src, intel_uncore_unit_type_t u, char *name, char *type_str, char *fmt, int *socket_by_cpu_id)
save_rewrite_length must be aligned so that reass doesn t overwrite it
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
VLIB_REGISTER_LOG_CLASS(if_intel_uncore_log, static)