Re: [PATCH] tracing/function-graph-tracer: strip ending newlineson comments

From: Ingo Molnar
Date: Tue Dec 23 2008 - 01:49:40 EST



* Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> Impact: trivial output improvement
>
> Ending newlines are appended automatically on comments by the function graph tracer
> because the newlines needs to be placed after the "*/" characters.
> So if the user puts an ending whitespace, we want to strip it.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>

applied to tip/tracing/function-graph-tracer, thanks Frederic!

> @@ -584,6 +585,11 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s,
> return TRACE_TYPE_PARTIAL_LINE;
> }
>
> + /* Strip ending newline on the comment */
> + len = strlen(trace->buf);
> + if (trace->buf[len - 1] == '\n')
> + trace->buf[len - 1] = '\0';
> +

Hm, dont we know the length of the buffer already, so that we could avoid
the strlen() overhead?

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/