Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2#include "builtin.h"
3#include "color.h"
4#include "util/debug.h"
5#include "util/header.h"
6#include <tools/config.h>
7#include <stdbool.h>
8#include <stdio.h>
9#include <string.h>
10#include <subcmd/parse-options.h>
11
12struct version {
13 bool build_options;
14};
15
16static struct version version;
17
18static struct option version_options[] = {
19 OPT_BOOLEAN(0, "build-options", &version.build_options,
20 "display the build options"),
21 OPT_END(),
22};
23
24static const char * const version_usage[] = {
25 "perf version [<options>]",
26 NULL
27};
28
29static void library_status(void)
30{
31 for (int i = 0; supported_features[i].name; ++i)
32 feature_status__printf(&supported_features[i]);
33}
34
35int cmd_version(int argc, const char **argv)
36{
37 argc = parse_options(argc, argv, version_options, version_usage,
38 PARSE_OPT_STOP_AT_NON_OPTION);
39
40 printf("perf version %s\n", perf_version_string);
41
42 if (version.build_options || verbose > 0)
43 library_status();
44
45 return 0;
46}