/* Helper function to print status of a feature along with name/macro */ void feature_status__printf(conststruct feature_status *feature)
{ constchar *name = feature->name, *macro = feature->macro,
*status = feature->is_builtin ? "on" : "OFF";
if (!feature->is_builtin && feature->tip)
printf(" ( tip: %s )", feature->tip);
putchar('\n');
}
/** * check whether "feature" is built-in with perf * * returns: * 0: NOT built-in or Feature not known * 1: Built-in
*/ staticint has_support(constchar *feature)
{ for (int i = 0; supported_features[i].name; ++i) { if ((strcasecmp(feature, supported_features[i].name) == 0) ||
(strcasecmp(feature, supported_features[i].macro) == 0)) { if (!quiet)
feature_status__printf(&supported_features[i]); return supported_features[i].is_builtin;
}
}
if (!quiet)
pr_err("Unknown feature '%s', please use 'perf version --build-options' to see which ones are available.\n", feature);
return 0;
}
/** * Usage: 'perf check feature <feature_list>' * * <feature_list> can be a single feature name/macro, or a comma-separated list * of feature names/macros * eg. argument can be "libtraceevent" or "libtraceevent,bpf" etc * * In case of a comma-separated list, feature_enabled will be 1, only if * all features passed in the string are supported * * Note that argv will get modified
*/ staticint subcommand_feature(int argc, constchar **argv)
{ char *feature_list; char *feature_name; int feature_enabled;
if (!argc)
usage_with_options(check_feature_usage, check_feature_options);
if (argc > 1) {
pr_err("Too many arguments passed to 'perf check feature'\n"); return -1;
}
feature_enabled = 1; /* feature_list is a non-const copy of 'argv[0]' */
feature_list = strdup(argv[0]); if (!feature_list) {
pr_err("ERROR: failed to allocate memory for feature list\n"); return -1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.