Linux-Trace-Devel Archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 3/4] trace-cmd show: Add option to read buffer_percent
Date: Thu, 28 Dec 2023 22:16:46 -0500	[thread overview]
Message-ID: <20231229031907.69432-4-rostedt@goodmis.org> (raw)
In-Reply-To: <20231229031907.69432-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Add trace-cmd show --buffer_percent to show the value of the buffer_percent
file.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 Documentation/trace-cmd/trace-cmd-show.1.txt | 8 ++++++++
 tracecmd/trace-show.c                        | 6 ++++++
 tracecmd/trace-usage.c                       | 1 +
 3 files changed, 15 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-show.1.txt b/Documentation/trace-cmd/trace-cmd-show.1.txt
index ac40dacf7061..f85c070b0598 100644
--- a/Documentation/trace-cmd/trace-cmd-show.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-show.1.txt
@@ -65,6 +65,14 @@ OPTIONS
      The ring buffer is broken up into equal size sub-buffers were an event can only
      be as big as the sub-buffer data section (the size minus its meta data).
 
+*--buffer_percent*::
+    Show the percentage the buffer must be filled before a reader that is blocked
+    on the trace_pipe_raw file will be woken up.
+
+  0       : wake up immediately on any new data
+  1 - 99  : wake up on this percentage of the sub-buffers being full
+  100     : wake up after the buffer is full and the writer is on the last sub-buffer
+
 *--ftrace_filter*::
      Show what function filters are set.
 
diff --git a/tracecmd/trace-show.c b/tracecmd/trace-show.c
index 17eb098952f7..d91362e47c50 100644
--- a/tracecmd/trace-show.c
+++ b/tracecmd/trace-show.c
@@ -20,6 +20,7 @@ enum {
 	OPT_buffer_subbuf_size_kb,
 	OPT_buffer_total_size_kb,
 	OPT_buffer_size_kb,
+	OPT_buffer_percent,
 	OPT_current_tracer,
 	OPT_tracing_on,
 };
@@ -44,6 +45,7 @@ void trace_show(int argc, char **argv)
 		{"buffer_size", no_argument, NULL, OPT_buffer_size_kb},
 		{"buffer_total_size", no_argument, NULL, OPT_buffer_total_size_kb},
 		{"buffer_subbuf_size", no_argument, NULL, OPT_buffer_subbuf_size_kb},
+		{"buffer_percent", no_argument, NULL, OPT_buffer_percent},
 		{"ftrace_filter", no_argument, NULL, OPT_ftrace_filter},
 		{"ftrace_notrace", no_argument, NULL, OPT_ftrace_notrace},
 		{"ftrace_pid", no_argument, NULL, OPT_ftrace_pid},
@@ -108,6 +110,10 @@ void trace_show(int argc, char **argv)
 			show_instance_file(instance, "buffer_subbuf_size_kb");
 			stop = 1;
 			break;
+		case OPT_buffer_percent:
+			show_instance_file(instance, "buffer_percent");
+			stop = 1;
+			break;
 		case OPT_ftrace_filter:
 			show_instance_file(instance, "set_ftrace_filter");
 			stop = 1;
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index 7dc9b1871398..3e5456d27e3d 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -181,6 +181,7 @@ static struct usage_help usage_help[] = {
 		"          --buffer_size (for buffer_size_kb)\n"
 		"          --buffer_total_size (for buffer_total_size_kb)\n"
 		"          --buffer_subbuf_size (for buffer_subbuf_size_kb)\n"
+		"          --buffer_percent (for buffer_percent)\n"
 		"          --ftrace_filter (for set_ftrace_filter)\n"
 		"          --ftrace_notrace (for set_ftrace_notrace)\n"
 		"          --ftrace_pid (for set_ftrace_pid)\n"
-- 
2.42.0


  parent reply	other threads:[~2023-12-29  3:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  3:16 [PATCH 0/4] trace-cmd: Add ways to read more tracefs files Steven Rostedt
2023-12-29  3:16 ` [PATCH 1/4] trace-cmd show: Re-arrange the enum long option values Steven Rostedt
2023-12-29  3:16 ` [PATCH 2/4] trace-cmd show: Add --buffer-subbuf-size option Steven Rostedt
2023-12-29  3:16 ` Steven Rostedt [this message]
2023-12-29  3:16 ` [PATCH 4/4] trace-cmd stat: Use tracefs_instance_file_read() Steven Rostedt

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=20231229031907.69432-4-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).