perf list: Separate the deprecated events
PATCH v2 1/1 perf list: Separate the deprecated events
There are some deprecated events listed by perf list. But we can't remove them from perf list with ease because some old scripts may use them.
Deprecated events are old names of renamed events. When an event gets renamed the old name is kept around for some time and marked with Deprecated. The newer Intel event lists in the tree already have these headers.
So we need to keep them in the event list, but show them in a separate area.
For example,
--- Following are deprecated events ---
cache:
l2_lines_out.useless_pref
[This event is deprecated. Refer to new event L2_LINES_OUT.USELESS_HWPF]
...
memory:
...
pipeline:
...
v2:
---
In v1, the deprecated events are hidden by default but they can be displayed when option "--deprecated" is enabled. In v2, we don't use the new option "--deprecated". Instead, we just display the deprecated events under the title "--- Following are deprecated events ---".
--- tools/perf/pmu-events/jevents.c | 26 ++++-- tools/perf/pmu-events/jevents.h | 3 +- tools/perf/pmu-events/pmu-events.h | 1 + tools/perf/util/pmu.c | 124 +++++++++++++++++++---------- tools/perf/util/pmu.h | 1 + 5 files changed, 107 insertions(+), 48 deletions(-)
tools/perf/pmu-events/jevents.c +20 -6
@@ -322,7 +322,8 @@ static int print_events_table_entry(void *data, char *name, char *event, char *desc, char *long_desc, char *pmu, char *unit, char *perpkg, char *metric_expr, - char *metric_name, char *metric_group) + char *metric_name, char *metric_group, + char *deprecated) { struct perf_entry_data *pd = data;FILE *outfp = pd->outfp;
@@ -354,6 +355,8 @@ static int print_events_table_entry(void *data, char *name, char *event,fprintf (outfp,"\t.metric_name = \"%s\",\n" , metric_name);if (metric_group)fprintf (outfp,"\t.metric_group = \"%s\",\n" , metric_group); +if (deprecated) +fprintf (outfp,"\t.deprecated = \"%s\",\n" , deprecated);fprintf (outfp,"},\n" );return 0 ;
@@ -371,6 +374,7 @@ struct event_struct {char *metric_expr;char *metric_name;char *metric_group; +char *deprecated; };#define ADD_EVENT_FIELD (field) do { if (field) { \
@@ -398,6 +402,7 @@ struct event_struct {op (metric_expr); \op (metric_name); \op (metric_group); \ +op (deprecated); \ }while (0 ) static LIST_HEAD(arch_std_events);
@@ -416,7 +421,8 @@ static void free_arch_std_events(void)static int save_arch_std_events (void *data,char *name,char *event,char *desc,char *long_desc,char *pmu,char *unit,char *perpkg,char *metric_expr, -char *metric_name,char *metric_group) +char *metric_name,char *metric_group, +char *deprecated) {struct event_struct *es;
@@ -479,7 +485,8 @@ static int try_fixup(const char *fn, char *arch_std, char **event, char **desc, char **name, char **long_desc, char **pmu, char **filter, char **perpkg, char **unit, char **metric_expr, char **metric_name, - char **metric_group, unsigned long long eventcode) + char **metric_group, unsigned long long eventcode, + char **deprecated) { /* try to find matching event from arch standard values */ struct event_struct *es;
@@ -507,7 +514,8 @@ int json_events(const char *fn,char *long_desc, char *pmu, char *unit, char *perpkg, char *metric_expr, - char *metric_name, char *metric_group), + char *metric_name, char *metric_group, + char *deprecated), void *data) { int err;
@@ -536,6 +544,7 @@ int json_events(const char *fn,char *metric_expr =NULL ;char *metric_name =NULL ;char *metric_group =NULL ; +char *deprecated =NULL ;char *arch_std =NULL ;unsigned long long eventcode =0 ;struct msrmap *msr =NULL ;
@@ -614,6 +623,8 @@ int json_events(const char *fn,addfield (map, &unit,"" ,"" , val); }else if (json_streq (map, field,"PerPkg" )) {addfield (map, &perpkg,"" ,"" , val); + }else if (json_streq (map, field,"Deprecated" )) { +addfield (map, &deprecated,"" ,"" , val); }else if (json_streq (map, field,"MetricName" )) {addfield (map, &metric_name,"" ,"" , val); }else if (json_streq (map, field,"MetricGroup" )) {
@@ -658,12 +669,14 @@ int json_events(const char *fn, err =try_fixup (fn, arch_std, &event, &desc, &name, &long_desc, &pmu, &filter, &perpkg, &unit, &metric_expr, &metric_name, - &metric_group, eventcode); + &metric_group, eventcode, + &deprecated);if (err) goto free_strings; } err =func (data, name,real_event (name, event), desc, long_desc, - pmu, unit, perpkg, metric_expr, metric_name, metric_group); + pmu, unit, perpkg, metric_expr, metric_name, + metric_group, deprecated); free_strings:free (event);free (desc);
@@ -673,6 +686,7 @@ int json_events(const char *fn,free (pmu);free (filter);free (perpkg); +free (deprecated);free (unit);free (metric_expr);free (metric_name);
tools/perf/pmu-events/jevents.h +2 -1
@@ -7,7 +7,8 @@ int json_events(const char *fn,char *long_desc, char *pmu, char *unit, char *perpkg, char *metric_expr, - char *metric_name, char *metric_group), + char *metric_name, char *metric_group, + char *deprecated), void *data);char *get_cpu_str (void );
tools/perf/pmu-events/pmu-events.h +1 -0
@@ -17,6 +17,7 @@ struct pmu_event {const char *metric_expr;const char *metric_name;const char *metric_group; +const char *deprecated; };/*
tools/perf/util/pmu.c +83 -41
187 lines not on this page · raw message
tools/perf/util/pmu.h +1 -0
@@ -57,6 +57,7 @@ struct perf_pmu_alias {double scale;bool per_pkg;bool snapshot; +bool deprecated;char *metric_expr;char *metric_name; };
Signature · 1 line
2.17.1
Quoted 6 lines
v2:
---
In v1, the deprecated events are hidden by default but they can be displayed when option "--deprecated" is enabled. In v2, we don't use the new option "--deprecated". Instead, we just display the deprecated events under the title "--- Following are deprecated events ---".
It's redundant with what the event description already says. If we always want to show it we don't need to do anything.
I really would much prefer to hide it. What's the point of showing something that people are not supposed to use?
The only reason for keeping the deprecated events is to not break old scripts, but those don't care about perf list output.
So I think the only sane option is to hide it by default.
-Andi
Quoted 7 lines · Andi Kleen
Quoted 6 lines
v2:
---
In v1, the deprecated events are hidden by default but they can be displayed when option "--deprecated" is enabled. In v2, we don't use the new option "--deprecated". Instead, we just display the deprecated events under the title "--- Following are deprecated events ---".
Quoted 8 lines
It's redundant with what the event description already says. If we always want to show it we don't need to do anything.
I really would much prefer to hide it. What's the point of showing something that people are not supposed to use?
The only reason for keeping the deprecated events is to not break old scripts, but those don't care about perf list output.
I thought this might be a problem for users,
but don't have anything to back this up ;-)
if that's the case we can go with the original patch
jirka
Quoted 4 lines
So I think the only sane option is to hide it by default.
-Andi
Quoted 17 lines · Jiri Olsa
Quoted 7 lines · Andi Kleen
Quoted 6 lines
v2:
---
In v1, the deprecated events are hidden by default but they can be displayed when option "--deprecated" is enabled. In v2, we don't use the new option "--deprecated". Instead, we just display the deprecated events under the title "--- Following are deprecated events ---".Quoted 8 lines
It's redundant with what the event description already says. If we always want to show it we don't need to do anything.
I really would much prefer to hide it. What's the point of showing something that people are not supposed to use?
The only reason for keeping the deprecated events is to not break old scripts, but those don't care about perf list output.
Quoted 7 lines
I thought this might be a problem for users,
but don't have anything to back this up ;-)if that's the case we can go with the original patch
jirka
I'm fine to go with the original patch. :)
Thanks
Jin Yao
Quoted 4 lines
Quoted 4 lines
So I think the only sane option is to hide it by default.
-Andi