2 * Copyright (c) 2022 Arm 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 <vnet/vnet.h>
17 #include <vppinfra/linux/sysfs.h>
18 #include <perfmon/perfmon.h>
19 #include <perfmon/arm/events.h>
21 /* as per .events[n] in PERFMON_REGISTER_BUNDLE */
29 format_arm_stall (u8 *s, va_list *args)
31 perfmon_node_stats_t *ns = va_arg (*args, perfmon_node_stats_t *);
32 int row = va_arg (*args, int);
37 s = format (s, "%llu", ns->value[STALL_BACKEND] / ns->n_packets);
41 s = format (s, "%llu", ns->value[STALL_FRONTEND] / ns->n_packets);
45 s = format (s, "%llu", ns->value[STALL_BACKEND] / ns->n_calls);
49 s = format (s, "%llu", ns->value[STALL_FRONTEND] / ns->n_calls);
53 s = format (s, "%llu", ns->n_packets);
57 s = format (s, "%llu", ns->n_calls);
63 PERFMON_REGISTER_BUNDLE (arm_stall) = {
65 .description = "PE cycle stalls per pkt/call",
67 .type = PERFMON_BUNDLE_TYPE_NODE,
68 .events[0] = ARMV8_PMUV3_STALL_BACKEND,
69 .events[1] = ARMV8_PMUV3_STALL_FRONTEND,
72 .format_fn = format_arm_stall,
73 .column_headers = PERFMON_STRINGS ("Backend/pkt", "Frontend/pkt",
74 "Backend/call", "Frontend/call",
77 * set a bit for every event used in each column
78 * this allows us to disable columns at bundle registration if an
79 * event is not supported
81 .column_events = PERFMON_COLUMN_EVENTS (SET_BIT (STALL_BACKEND),
82 SET_BIT (STALL_FRONTEND),
83 SET_BIT (STALL_BACKEND),
84 SET_BIT (STALL_FRONTEND), 0, 0),
86 "The stall counter counts every Attributable cycle on which no\n"
87 "Attributable instruction or operation was sent for execution\n"
89 " Stall backend: No operation issued due to the backend\n"
90 " Stall frontend: No operation issued due to the frontend\n"
91 "The division between frontend and backend is IMPLEMENTATION DEFINED\n\n"
92 "- See Armv8-A Architecture Reference Manual, D7.10 PMU events and"
93 " event numbers for full description.\n"