[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c62985530812230414y695e36b3oa03b6679a20fb14f@mail.gmail.com>
Date: Tue, 23 Dec 2008 13:14:37 +0100
From: "Frédéric Weisbecker" <fweisbec@...il.com>
To: "Ingo Molnar" <mingo@...e.hu>
Cc: "Steven Rostedt" <rostedt@...dmis.org>,
"Linux Kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/function-graph-tracer: strip ending newlines on comments
2008/12/23 Ingo Molnar <mingo@...e.hu>:
>
> * Frederic Weisbecker <fweisbec@...il.com> 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@...il.com>
>
> 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
>
We know it during the insertion. But we need a new field struct print_entry.
That makes me remind that I didn't considered the TRACE_CONT rest of
the buffer in this patch.
Actually, the most easy solution would be to print entirely the buffer
to the seq, and then delete
the newline directly to the seq. That would be a bit crappy but
actually the only solution.
So my patch is wrong in cases of long messages.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists