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

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

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * builtin-config.c
  3  *
  4  * Copyright (C) 2015, Taeung Song <treeze.taeung@gmail.com>
  5  *
  6  */
  7 #include "builtin.h"
  8 
  9 #include "perf.h"
 10 
 11 #include "util/cache.h"
 12 #include <subcmd/parse-options.h>
 13 #include "util/util.h"
 14 #include "util/debug.h"
 15 
 16 static const char * const config_usage[] = {
 17         "perf config [options]",
 18         NULL
 19 };
 20 
 21 enum actions {
 22         ACTION_LIST = 1
 23 } actions;
 24 
 25 static struct option config_options[] = {
 26         OPT_SET_UINT('l', "list", &actions,
 27                      "show current config variables", ACTION_LIST),
 28         OPT_END()
 29 };
 30 
 31 static int show_config(const char *key, const char *value,
 32                        void *cb __maybe_unused)
 33 {
 34         if (value)
 35                 printf("%s=%s\n", key, value);
 36         else
 37                 printf("%s\n", key);
 38 
 39         return 0;
 40 }
 41 
 42 int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 43 {
 44         int ret = 0;
 45 
 46         argc = parse_options(argc, argv, config_options, config_usage,
 47                              PARSE_OPT_STOP_AT_NON_OPTION);
 48 
 49         switch (actions) {
 50         case ACTION_LIST:
 51                 if (argc) {
 52                         pr_err("Error: takes no arguments\n");
 53                         parse_options_usage(config_usage, config_options, "l", 1);
 54                 } else {
 55                         ret = perf_config(show_config, NULL);
 56                         if (ret < 0)
 57                                 pr_err("Nothing configured, "
 58                                        "please check your ~/.perfconfig file\n");
 59                 }
 60                 break;
 61         default:
 62                 usage_with_options(config_usage, config_options);
 63         }
 64 
 65         return ret;
 66 }
 67 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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