~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/builtin-version.c

Version: ~ [ linux-6.6-rc1 ] ~ [ linux-6.5.2 ] ~ [ linux-6.4.15 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.52 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.131 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.194 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.256 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.294 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.325 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp