xref: /kernel/linux/linux-5.10/tools/perf/include/bpf/stdio.h (revision 8c2ecf20)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/perf/include/bpf/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#include <bpf.h>
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cistruct bpf_map SEC("maps") __bpf_stdout__ = {
68c2ecf20Sopenharmony_ci       .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
78c2ecf20Sopenharmony_ci       .key_size = sizeof(int),
88c2ecf20Sopenharmony_ci       .value_size = sizeof(u32),
98c2ecf20Sopenharmony_ci       .max_entries = __NR_CPUS__,
108c2ecf20Sopenharmony_ci};
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define puts(from) \
138c2ecf20Sopenharmony_ci	({ const int __len = sizeof(from); \
148c2ecf20Sopenharmony_ci	   char __from[__len] = from; \
158c2ecf20Sopenharmony_ci	   perf_event_output(args, &__bpf_stdout__, BPF_F_CURRENT_CPU, \
168c2ecf20Sopenharmony_ci			  &__from, __len & (sizeof(from) - 1)); })
17

Indexes created Thu Nov 07 10:32:03 CST 2024