Skip to contentSkip to conversation

perf report: Fix -F for branch & mem modes

PATCH Applied Ravi Bangoria 3 participants 3 messages Mar 4, 2021 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: Fix -F for branch & mem modes

perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it.

Before patch:

  $ ./perf record -b
  $ ./perf report -b -F +srcline_from --stdio
  Error:
  Invalid --fields key: `srcline_from'

After patch:

  $ ./perf report -b -F +srcline_from --stdio
  # Samples: 8K of event 'cycles'
  # Event count (approx.): 8784
  ...
Fixes aa6b3c99236b ("perf report: Make -F more strict like -s")
---
 tools/perf/util/sort.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/sort.c +2 -2
index 0d5ad42812b9..552b590485bf 100644
@@ -3140,7 +3140,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__MEMORY)
+		if (sort__mode != SORT_MODE__BRANCH)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
@@ -3152,7 +3152,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__BRANCH)
+		if (sort__mode != SORT_MODE__MEMORY)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
Signature · 1 line
2.29.2
#1 lore raw
Quoted 16 lines · Ravi Bangoria

perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it.

Before patch:

 $ ./perf record -b
 $ ./perf report -b -F +srcline_from --stdio
 Error:
 Invalid --fields key: `srcline_from'

After patch:

Quoted 8 lines
 $ ./perf report -b -F +srcline_from --stdio
 # Samples: 8K of event 'cycles'
 # Event count (approx.): 8784
 ...
Fixes aa6b3c99236b ("perf report: Make -F more strict like -s")

Thanks for the fix Ravi.

Reviewed-and-tested-by Athira Rajeev <[email protected]>
Quoted 29 lines

---
tools/perf/util/sort.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/sort.c +2 -2
index 0d5ad42812b9..552b590485bf 100644
@@ -3140,7 +3140,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__MEMORY)
+		if (sort__mode != SORT_MODE__BRANCH)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
@@ -3152,7 +3152,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__BRANCH)
+		if (sort__mode != SORT_MODE__MEMORY)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
Signature · 1 line
2.29.2
maintainer Applied
#2 lore raw

Em Thu, Mar 04, 2021 at 12:15:58PM +0530, Athira Rajeev escreveu:

Quoted 19 lines
Quoted 19 lines · Ravi Bangoria

perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it.

Before patch:

 $ ./perf record -b
 $ ./perf report -b -F +srcline_from --stdio
 Error:
 Invalid --fields key: `srcline_from'

After patch:

 $ ./perf report -b -F +srcline_from --stdio
 # Samples: 8K of event 'cycles'
 # Event count (approx.): 8784
 ...
Quoted 7 lines
Quoted 3 lines
Fixes aa6b3c99236b ("perf report: Make -F more strict like -s")

Thanks for the fix Ravi.

Reviewed-and-tested-by Athira Rajeev <[email protected]>

Thanks, applied.

- Arnaldo

Quoted 30 lines
Quoted 29 lines

---
tools/perf/util/sort.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/sort.c +2 -2
index 0d5ad42812b9..552b590485bf 100644
@@ -3140,7 +3140,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__MEMORY)
+		if (sort__mode != SORT_MODE__BRANCH)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
@@ -3152,7 +3152,7 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
-		if (sort__mode != SORT_MODE__BRANCH)
+		if (sort__mode != SORT_MODE__MEMORY)
 			return -EINVAL;
 
 		return __sort_dimension__add_output(list, sd);
Signature · 1 line
2.29.2
Signature · 1 line
- Arnaldo