Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include "builtin.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include "perf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include "color.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <tools/config.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <subcmd/parse-options.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) int version_verbose;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	bool	build_options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) static struct version version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static struct option version_options[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	OPT_BOOLEAN(0, "build-options", &version.build_options,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 		    "display the build options"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	OPT_END(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static const char * const version_usage[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	"perf version [<options>]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static void on_off_print(const char *status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	printf("[ ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	if (!strcmp(status, "OFF"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		color_fprintf(stdout, PERF_COLOR_RED, "%-3s", status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		color_fprintf(stdout, PERF_COLOR_GREEN, "%-3s", status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	printf(" ]");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static void status_print(const char *name, const char *macro,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 			 const char *status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	printf("%22s: ", name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	on_off_print(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	printf("  # %s\n", macro);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define STATUS(__d, __m)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	if (IS_BUILTIN(__d))				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		status_print(#__m, #__d, "on");		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	else						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		status_print(#__m, #__d, "OFF");	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static void library_status(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	STATUS(HAVE_DWARF_SUPPORT, dwarf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	STATUS(HAVE_GLIBC_SUPPORT, glibc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #ifndef HAVE_SYSCALL_TABLE_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	STATUS(HAVE_SYSCALL_TABLE_SUPPORT, syscall_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	STATUS(HAVE_LIBBFD_SUPPORT, libbfd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	STATUS(HAVE_LIBELF_SUPPORT, libelf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	STATUS(HAVE_LIBNUMA_SUPPORT, libnuma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	STATUS(HAVE_LIBNUMA_SUPPORT, numa_num_possible_cpus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	STATUS(HAVE_LIBPERL_SUPPORT, libperl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	STATUS(HAVE_LIBPYTHON_SUPPORT, libpython);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	STATUS(HAVE_SLANG_SUPPORT, libslang);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	STATUS(HAVE_LIBCRYPTO_SUPPORT, libcrypto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	STATUS(HAVE_LIBUNWIND_SUPPORT, libunwind);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	STATUS(HAVE_DWARF_SUPPORT, libdw-dwarf-unwind);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	STATUS(HAVE_ZLIB_SUPPORT, zlib);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	STATUS(HAVE_LZMA_SUPPORT, lzma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	STATUS(HAVE_LIBBPF_SUPPORT, bpf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 	STATUS(HAVE_AIO_SUPPORT, aio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 	STATUS(HAVE_ZSTD_SUPPORT, zstd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) int cmd_version(int argc, const char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	argc = parse_options(argc, argv, version_options, version_usage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 			     PARSE_OPT_STOP_AT_NON_OPTION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 	printf("perf version %s\n", perf_version_string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 	if (version.build_options || version_verbose == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 		library_status();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }