perf trace: Remove return value of trace__fprintf_tp_fields
PATCH 1/1 perf trace: Remove return value of trace__fprintf_tp_fields
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
---
This is a small followup cleanup to my earlier commit 5fb8e56542a3 ("perf
trace: avoid garbage when not printing a trace event's arguments").
--- tools/perf/builtin-trace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/builtin-trace.c +3 -3
@@ -3022,8 +3022,8 @@ static void bpf_output__fprintf(struct trace *trace, ++trace->nr_events_printed; } -static size_t trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, -struct thread *thread,void *augmented_args,int augmented_args_size) +static void trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, +struct thread *thread,void *augmented_args,int augmented_args_size) {char bf[2048 ];size_t size =sizeof (bf);
@@ -3088,7 +3088,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, printed +=syscall_arg_fmt__scnprintf_val (arg, bf + printed, size - printed, &syscall_arg, val); } -return printed +fprintf (trace->output,"%.*s" , (int )printed, bf); +fprintf (trace->output,"%.*s" , (int )printed, bf); } static int trace__event_handler(struct trace *trace, struct evsel *evsel,
---
base-commit: eefa7a9c069908412f8f5d15833901d1b46ae1b2
change-id: 20241212-void-fprintf_tp_fields-8aaae2f5525f
Best regards,
Signature · 1 line
Benjamin Peterson <[email protected]>
Hello Benjamin,
Quoted 41 lines · Benjamin Peterson
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
Signed-off-by Benjamin Peterson <[email protected]>---
This is a small followup cleanup to my earlier commit5fb8e56542a3("perf
trace: avoid garbage when not printing a trace event's arguments").--- tools/perf/builtin-trace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/perf/builtin-trace.c +3
-4@@ -3022,8 +3022,8 @@ static void bpf_output__fprintf(struct trace *trace, ++trace->nr_events_printed; } -static size_t trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, -struct thread *thread,void *augmented_args,int augmented_args_size) +static void trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, +struct thread *thread,void *augmented_args,int augmented_args_size) {char bf[2048 ];size_t size =sizeof (bf);@@ -3088,7 +3088,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, printed +=syscall_arg_fmt__scnprintf_val (arg, bf + printed, size - printed, &syscall_arg, val); } -return printed +fprintf (trace->output,"%.*s" , (int )printed, bf); +fprintf (trace->output,"%.*s" , (int )printed, bf); } static int trace__event_handler(struct trace *trace, struct evsel *evsel, ---base-commit:
eefa7a9c069908412f8f5d15833901d1b46ae1b2
change-id: 20241212-void-fprintf_tp_fields-8aaae2f5525f
Quoted 5 lines
Best regards,
--
Benjamin Peterson <[email protected]>
Thank you for the follow-up patch, LGTM. Built and tested.
perf $ ./perf test "perf trace"
109: perf trace enum augmentation tests : Ok
110: perf trace exit race : Ok
Thanks,
Howard
Hello fellow maintainers,
Just a slight ping.
Thanks,
Howard
Quoted 61 lines · Howard Chu
Hello Benjamin,
Quoted 41 lines · Benjamin Peterson
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
Signed-off-by Benjamin Peterson <[email protected]>---
This is a small followup cleanup to my earlier commit5fb8e56542a3("perf
trace: avoid garbage when not printing a trace event's arguments").--- tools/perf/builtin-trace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/perf/builtin-trace.c +3
-4@@ -3022,8 +3022,8 @@ static void bpf_output__fprintf(struct trace *trace, ++trace->nr_events_printed; } -static size_t trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, -struct thread *thread,void *augmented_args,int augmented_args_size) +static void trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, +struct thread *thread,void *augmented_args,int augmented_args_size) {char bf[2048 ];size_t size =sizeof (bf);@@ -3088,7 +3088,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, printed +=syscall_arg_fmt__scnprintf_val (arg, bf + printed, size - printed, &syscall_arg, val); } -return printed +fprintf (trace->output,"%.*s" , (int )printed, bf); +fprintf (trace->output,"%.*s" , (int )printed, bf); } static int trace__event_handler(struct trace *trace, struct evsel *evsel, ---base-commit:
eefa7a9c069908412f8f5d15833901d1b46ae1b2
change-id: 20241212-void-fprintf_tp_fields-8aaae2f5525fQuoted 5 lines
Best regards,
--
Benjamin Peterson <[email protected]>Thank you for the follow-up patch, LGTM. Built and tested.
perf $ ./perf test "perf trace"
109: perf trace enum augmentation tests : Ok
110: perf trace exit race : OkReviewed-by Howard Chu <[email protected]>Thanks,
Howard
Namhyung Kim
maintainerHello,
Quoted 3 lines · Howard Chu
Hello fellow maintainers,
Just a slight ping.
Thanks for the reminder.
Quoted 12 lines
Thanks,
HowardQuoted 7 lines · Howard Chu
Hello Benjamin,
Quoted 3 lines · Benjamin Peterson
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
In fact, I don't see the reason to merge this, as it's the convention to return the number of characters it prints. Yes, it's not used but not much reason to remove it.
Thanks,
Namhyung
Quoted 54 lines
Quoted 54 lines
Quoted 38 lines
Signed-off-by Benjamin Peterson <[email protected]>---
This is a small followup cleanup to my earlier commit5fb8e56542a3("perf
trace: avoid garbage when not printing a trace event's arguments").--- tools/perf/builtin-trace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/perf/builtin-trace.c +3
-4@@ -3022,8 +3022,8 @@ static void bpf_output__fprintf(struct trace *trace, ++trace->nr_events_printed; } -static size_t trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, -struct thread *thread,void *augmented_args,int augmented_args_size) +static void trace__fprintf_tp_fields (struct trace *trace,struct evsel *evsel,struct perf_sample *sample, +struct thread *thread,void *augmented_args,int augmented_args_size) {char bf[2048 ];size_t size =sizeof (bf);@@ -3088,7 +3088,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, printed +=syscall_arg_fmt__scnprintf_val (arg, bf + printed, size - printed, &syscall_arg, val); } -return printed +fprintf (trace->output,"%.*s" , (int )printed, bf); +fprintf (trace->output,"%.*s" , (int )printed, bf); } static int trace__event_handler(struct trace *trace, struct evsel *evsel, ---base-commit:
eefa7a9c069908412f8f5d15833901d1b46ae1b2
change-id: 20241212-void-fprintf_tp_fields-8aaae2f5525fQuoted 5 lines
Best regards,
--
Benjamin Peterson <[email protected]>Thank you for the follow-up patch, LGTM. Built and tested.
perf $ ./perf test "perf trace"
109: perf trace enum augmentation tests : Ok
110: perf trace exit race : OkReviewed-by Howard Chu <[email protected]>Thanks,
Howard
Quoted 9 lines · Namhyung Kim
Hello,
Quoted 3 lines · Howard Chu
Hello fellow maintainers,
Just a slight ping.
Thanks for the reminder.
Thanks for taking a look.
Quoted 9 lines
Quoted 9 lines
Thanks,
HowardQuoted 3 lines · Howard Chu
Hello Benjamin,
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines · Benjamin Peterson
Quoted 3 lines
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
In fact, I don't see the reason to merge this, as it's the convention to return the number of characters it prints. Yes, it's not used but not much reason to remove it.
The main reason to remove the return value is that it has no useful interpretation and is therefore confusing. To wit, the function returns two times the number of bytes it prints.
Namhyung Kim
maintainerQuoted 27 lines · Benjamin Peterson
Quoted 9 lines · Namhyung Kim
Hello,
Quoted 3 lines · Howard Chu
Hello fellow maintainers,
Just a slight ping.
Thanks for the reminder.
Thanks for taking a look.
Quoted 14 lines
Quoted 13 lines
Thanks,
HowardQuoted 7 lines · Howard Chu
Hello Benjamin,
Quoted 3 lines · Benjamin Peterson
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
Quoted 7 lines
Quoted 3 lines
In fact, I don't see the reason to merge this, as it's the convention to return the number of characters it prints. Yes, it's not used but not much reason to remove it.
The main reason to remove the return value is that it has no useful interpretation and is therefore confusing. To wit, the function returns two times the number of bytes it prints.
Oh, ok. Then please just fix it to return the correct number.
Thanks,
Namhyung
Quoted 33 lines · Namhyung Kim
Quoted 31 lines · Benjamin Peterson
Quoted 9 lines · Namhyung Kim
Hello,
Quoted 3 lines · Howard Chu
Hello fellow maintainers,
Just a slight ping.
Thanks for the reminder.
Thanks for taking a look.
Quoted 17 lines
Quoted 13 lines
Thanks,
HowardQuoted 7 lines · Howard Chu
Hello Benjamin,
Quoted 3 lines · Benjamin Peterson
The return value of this function was meaningless and therefore ignored by the caller. Remove it.
In fact, I don't see the reason to merge this, as it's the convention to return the number of characters it prints. Yes, it's not used but not much reason to remove it.
Quoted 5 lines
Quoted 3 lines
The main reason to remove the return value is that it has no useful interpretation and is therefore confusing. To wit, the function returns two times the number of bytes it prints.
Oh, ok. Then please just fix it to return the correct number.
Alright, I've submitted v2 that simply propagates the return value of fprintf.