diff options
Diffstat (limited to 'tools/perf/builtin-list.c')
| -rw-r--r-- | tools/perf/builtin-list.c | 48 | 
1 files changed, 34 insertions, 14 deletions
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 1f5dbd5f0ba4..7fec2cca759f 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -11,10 +11,11 @@  #include "builtin.h"  #include "util/print-events.h" +#include "util/pmus.h"  #include "util/pmu.h" -#include "util/pmu-hybrid.h"  #include "util/debug.h"  #include "util/metricgroup.h" +#include "util/pfm.h"  #include "util/string2.h"  #include "util/strlist.h"  #include "util/strbuf.h" @@ -192,9 +193,14 @@ static void default_print_metric(void *ps,  		if (group && print_state->metricgroups) {  			if (print_state->name_only)  				printf("%s ", group); -			else if (print_state->metrics) -				printf("\n%s:\n", group); -			else +			else if (print_state->metrics) { +				const char *gdesc = describe_metricgroup(group); + +				if (gdesc) +					printf("\n%s: [%s]\n", group, gdesc); +				else +					printf("\n%s:\n", group); +			} else  				printf("%s\n", group);  		}  		zfree(&print_state->last_metricgroups); @@ -429,7 +435,7 @@ int cmd_list(int argc, const char **argv)  		.print_event = default_print_event,  		.print_metric = default_print_metric,  	}; -	const char *hybrid_name = NULL; +	const char *cputype = NULL;  	const char *unit_name = NULL;  	bool json = false;  	struct option list_options[] = { @@ -443,8 +449,8 @@ int cmd_list(int argc, const char **argv)  			    "Print information on the perf event names and expressions used internally by events."),  		OPT_BOOLEAN(0, "deprecated", &default_ps.deprecated,  			    "Print deprecated events."), -		OPT_STRING(0, "cputype", &hybrid_name, "hybrid cpu type", -			   "Limit PMU or metric printing to the given hybrid PMU (e.g. core or atom)."), +		OPT_STRING(0, "cputype", &cputype, "cpu type", +			   "Limit PMU or metric printing to the given PMU (e.g. cpu, core or atom)."),  		OPT_STRING(0, "unit", &unit_name, "PMU name",  			   "Limit PMU or metric printing to the specified PMU."),  		OPT_INCR(0, "debug", &verbose, @@ -452,7 +458,11 @@ int cmd_list(int argc, const char **argv)  		OPT_END()  	};  	const char * const list_usage[] = { +#ifdef HAVE_LIBPFM +		"perf list [<options>] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob|pfm]", +#else  		"perf list [<options>] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob]", +#endif  		NULL  	}; @@ -484,10 +494,15 @@ int cmd_list(int argc, const char **argv)  		assert(default_ps.visited_metrics);  		if (unit_name)  			default_ps.pmu_glob = strdup(unit_name); -		else if (hybrid_name) { -			default_ps.pmu_glob = perf_pmu__hybrid_type_to_pmu(hybrid_name); -			if (!default_ps.pmu_glob) -				pr_warning("WARNING: hybrid cputype is not supported!\n"); +		else if (cputype) { +			const struct perf_pmu *pmu = perf_pmus__pmu_for_pmu_filter(cputype); + +			if (!pmu) { +				pr_err("ERROR: cputype is not supported!\n"); +				ret = -1; +				goto out; +			} +			default_ps.pmu_glob = pmu->name;  		}  	}  	print_cb.print_start(ps); @@ -517,7 +532,7 @@ int cmd_list(int argc, const char **argv)  			 strcmp(argv[i], "hwcache") == 0)  			print_hwcache_events(&print_cb, ps);  		else if (strcmp(argv[i], "pmu") == 0) -			print_pmu_events(&print_cb, ps); +			perf_pmus__print_pmu_events(&print_cb, ps);  		else if (strcmp(argv[i], "sdt") == 0)  			print_sdt_events(&print_cb, ps);  		else if (strcmp(argv[i], "metric") == 0 || strcmp(argv[i], "metrics") == 0) { @@ -529,7 +544,12 @@ int cmd_list(int argc, const char **argv)  			default_ps.metricgroups = true;  			default_ps.metrics = false;  			metricgroup__print(&print_cb, ps); -		} else if ((sep = strchr(argv[i], ':')) != NULL) { +		} +#ifdef HAVE_LIBPFM +		else if (strcmp(argv[i], "pfm") == 0) +			print_libpfm_events(&print_cb, ps); +#endif +		else if ((sep = strchr(argv[i], ':')) != NULL) {  			char *old_pmu_glob = default_ps.pmu_glob;  			default_ps.event_glob = strdup(argv[i]); @@ -557,7 +577,7 @@ int cmd_list(int argc, const char **argv)  					event_symbols_sw, PERF_COUNT_SW_MAX);  			print_tool_events(&print_cb, ps);  			print_hwcache_events(&print_cb, ps); -			print_pmu_events(&print_cb, ps); +			perf_pmus__print_pmu_events(&print_cb, ps);  			print_tracepoint_events(&print_cb, ps);  			print_sdt_events(&print_cb, ps);  			default_ps.metrics = true;  | 
