From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Trond Myklebust <trond.myklebust@primarydata.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
Ingo Molnar <mingo@redhat.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: [for-next][PATCH 7/7] printk, tracing: Avoiding unneeded blank lines
Date: Sat, 16 Jul 2016 03:16:24 -0400 [thread overview]
Message-ID: <20160716071647.820702502@goodmis.org> (raw)
In-Reply-To: 20160716071617.711980454@goodmis.org
[-- Attachment #1: 0007-printk-tracing-Avoiding-unneeded-blank-lines.patch --]
[-- Type: text/plain, Size: 2297 bytes --]
From: Daniel Bristot de Oliveira <bristot@redhat.com>
Printk messages often finish with '\n' to cause a new line.
But as each tracepoint is already printed in a new line,
printk messages that finish with '\n' ends up adding a blank
line to the trace output. For example:
kworker/0:1-86 [000] d... 46.006949: console: [ 46.006946] usb 1-3: USB disconnect, device number 3
kworker/2:2-374 [002] d... 48.699342: console: [ 48.699339] usb 1-3: new high-speed USB device number 4 using ehci-pci
kworker/2:2-374 [002] d... 49.041450: console: [ 49.041448] usb 1-3: New USB device found, idVendor=5986, idProduct=0
To avoid unneeded blank lines, this patch checks if the printk
message finishes with '\n', if so, it cut is off the '\n' to
avoid blank lines.
In a patched kernel, the same messages are printed without
extra blank lines. For example:
kworker/0:4-185 [000] d... 23.641738: console: [ 23.641736] usb 1-3: USB disconnect, device number 3
kworker/0:4-185 [000] d... 24.918703: console: [ 24.918700] usb 1-3: new high-speed USB device number 4 using ehci-pci
kworker/0:4-185 [000] d... 25.228308: console: [ 25.228306] usb 1-3: New USB device found, idVendor=5986, idProduct=02d5
Link: http://lkml.kernel.org/r/c350fb2521baaf681a1b4d67981ca0e900108e8e.1467407618.git.bristot@redhat.com
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: Ingo Molnar <mingo@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/events/printk.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
index 542a7558154a..f350170059c6 100644
--- a/include/trace/events/printk.h
+++ b/include/trace/events/printk.h
@@ -16,6 +16,14 @@ TRACE_EVENT(console,
),
TP_fast_assign(
+ /*
+ * Each trace entry is printed in a new line.
+ * If the msg finishes with '\n', cut it off
+ * to avoid blank lines in the trace.
+ */
+ if ((len > 0) && (text[len-1] == '\n'))
+ len -= 1;
+
memcpy(__get_str(msg), text, len);
__get_str(msg)[len] = 0;
),
--
2.8.1
prev parent reply other threads:[~2016-07-16 7:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-16 7:16 [for-next][PATCH 0/7] tracing: Some last updates for 4.8 Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 1/7] tracing: Using for_each_set_bit() to simplify trace_pid_write() Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 2/7] tracing: Have HIST_TRIGGERS select TRACING Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 3/7] ftrace: Reduce size of function graph entries Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 4/7] tracing: Use outer () on __get_str() definition Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 5/7] tracing, RAS: Cleanup on __get_str() usage Steven Rostedt
2016-07-16 7:16 ` [for-next][PATCH 6/7] tracing: Use __get_str() when manipulating strings Steven Rostedt
2016-07-16 7:16 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160716071647.820702502@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=anna.schumaker@netapp.com \
--cc=bristot@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox