2 * Copyright (c) 2022 Intel and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <perfmon/perfmon.h>
17 #include <perfmon/intel/core.h>
28 format_intel_frontend_bound_bw (u8 *s, va_list *args)
30 perfmon_node_stats_t *ss = va_arg (*args, perfmon_node_stats_t *);
31 int row = va_arg (*args, int);
33 f64 uops = ss->value[DSB_UOPS] + ss->value[MS_UOPS] + ss->value[MITE_UOPS] +
41 sv = uops / ss->n_packets;
42 s = format (s, "%.0f", sv);
50 sv = (ss->value[DSB_UOPS] / uops) * 100;
53 sv = (ss->value[MS_UOPS] / uops) * 100;
56 sv = (ss->value[MITE_UOPS] / uops) * 100;
59 sv = (ss->value[LSD_UOPS] / uops) * 100;
63 s = format (s, "%04.1f", sv);
68 static perfmon_cpu_supports_t frontend_bound_bw_cpu_supports[] = {
69 { clib_cpu_supports_avx512_bitalg, PERFMON_BUNDLE_TYPE_NODE },
72 PERFMON_REGISTER_BUNDLE (intel_core_frontend_bound_bw) = {
73 .name = "td-frontend-bw",
75 "Topdown FrontEnd-bound BandWidth - % uops from each uop fetch source",
76 .source = "intel-core",
77 .events[0] = INTEL_CORE_E_IDQ_DSB_UOPS, /* 0x0F */
78 .events[1] = INTEL_CORE_E_IDQ_MS_UOPS, /* 0x0F */
79 .events[2] = INTEL_CORE_E_IDQ_MITE_UOPS, /* 0x0F */
80 .events[3] = INTEL_CORE_E_LSD_UOPS, /* 0x0F */
82 .format_fn = format_intel_frontend_bound_bw,
83 .cpu_supports = frontend_bound_bw_cpu_supports,
84 .n_cpu_supports = ARRAY_LEN (frontend_bound_bw_cpu_supports),
85 .column_headers = PERFMON_STRINGS ("UOPs/PKT", "% DSB UOPS", "% MS UOPS",
86 "% MITE UOPS", "% LSD UOPS"),
88 "For more information, see the Intel(R) 64 and IA-32 Architectures\n"
89 "Optimization Reference Manual section on the Front End.",