1 /* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2022 Cisco Systems, Inc.
7 #include <vppinfra/format.h>
8 #include <vppinfra/error.h>
9 #include <vppinfra/perfmon/perfmon.h>
12 format_perfmon_bundle_core_power (u8 *s, va_list *args)
14 clib_perfmon_ctx_t __clib_unused *ctx = va_arg (*args, clib_perfmon_ctx_t *);
15 clib_perfmon_capture_t *c = va_arg (*args, clib_perfmon_capture_t *);
16 u32 col = va_arg (*args, int);
22 return format (s, "%7.1f %%", (f64) 100 * d[1] / d[0]);
24 return format (s, "%7.1f %%", (f64) 100 * d[2] / d[0]);
26 return format (s, "%7.1f %%", (f64) 100 * d[3] / d[0]);
32 #define PERF_INTEL_CODE(event, umask) ((event) | (umask) << 8)
34 CLIB_PERFMON_BUNDLE (core_power) = {
37 "Core cycles where the core was running under specific turbo schedule.",
38 .type = PERF_TYPE_RAW,
39 .config[0] = PERF_INTEL_CODE (0x3c, 0x00),
40 .config[1] = PERF_INTEL_CODE (0x28, 0x07),
41 .config[2] = PERF_INTEL_CODE (0x28, 0x18),
42 .config[3] = PERF_INTEL_CODE (0x28, 0x20),
44 .format_fn = format_perfmon_bundle_core_power,
45 .column_headers = CLIB_STRING_ARRAY ("Level 0", "Level 1", "Level 2"),