mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Howard Cochran <hcochran@kernelspring.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Howard Cochran <hcochran@kernelspring.com>,
	linux-kernel@vger.kernel.org,
	Howard Cochran <cochran@lexmark.com>
Subject: [PATCH v3 1/5] trace-cmd extract: Add -B and -t for multiple instances
Date: Wed, 22 Apr 2015 00:55:10 -0400	[thread overview]
Message-ID: <7b18a3f624fd1e864a86c0cee2079587953fa5ee.1429677461.git.hcochran@kernelspring.com> (raw)
In-Reply-To: <cover.1429677461.git.hcochran@kernelspring.com>
In-Reply-To: <cover.1429677461.git.hcochran@kernelspring.com>

Add -B option to trace-cmd extract so that it can extract listed
instances. As with start, stop, and reset, the top level instance is not
included when any -B are given. However, -t makes it also include the
top instance. As with other commands, if neither option is given, only
operate on the top instance.

Signed-off-by: Howard Cochran <hcochran@kernelspring.com>
---
 trace-record.c | 20 +++++++++++++-------
 trace-usage.c  |  6 ++++--
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/trace-record.c b/trace-record.c
index 6e0ab3b..8340416 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -523,17 +523,20 @@ static int create_recorder(struct buffer_instance *instance, int cpu,
 
 static void flush_threads(void)
 {
+	struct buffer_instance *instance;
 	long ret;
 	int i;
 
 	if (!cpu_count)
 		return;
 
-	for (i = 0; i < cpu_count; i++) {
-		/* Extract doesn't support sub buffers yet */
-		ret = create_recorder(&top_instance, i, TRACE_TYPE_EXTRACT, NULL);
-		if (ret < 0)
-			die("error reading ring buffer");
+	for_all_instances(instance) {
+		for (i = 0; i < cpu_count; i++) {
+			/* Extract doesn't support sub buffers yet */
+			ret = create_recorder(instance, i, TRACE_TYPE_EXTRACT, NULL);
+			if (ret < 0)
+				die("error reading ring buffer");
+		}
 	}
 }
 
@@ -3873,7 +3876,7 @@ void trace_record (int argc, char **argv)
 		};
 
 		if (extract)
-			opts = "+haf:Fp:co:O:sr:g:l:n:P:N:tb:ksiT";
+			opts = "+haf:Fp:co:O:sr:g:l:n:P:N:tb:B:ksiT";
 		else
 			opts = "+hae:f:Fp:cC:dDGo:O:s:r:vg:l:n:P:N:tb:R:B:ksSiTm:M:H:";
 		c = getopt_long (argc-1, argv+1, opts, long_options, &option_index);
@@ -4061,7 +4064,10 @@ void trace_record (int argc, char **argv)
 			instance->cpumask = optarg;
 			break;
 		case 't':
-			use_tcp = 1;
+			if (extract)
+				topt = 1; /* Extract top instance also */
+			else
+				use_tcp = 1;
 			break;
 		case 'b':
 			instance->buffer_size = atoi(optarg);
diff --git a/trace-usage.c b/trace-usage.c
index 520b14b..a708a85 100644
--- a/trace-usage.c
+++ b/trace-usage.c
@@ -62,9 +62,11 @@ static struct usage_help usage_help[] = {
 	{
 		"extract",
 		"extract a trace from the kernel",
-		" %s extract [-p plugin][-O option][-o file][-s]\n"
-		"          Uses same options as record, but only reads an existing trace.\n"
+		" %s extract [-p plugin][-O option][-o file][-B buf][-s][-t]\n"
+		"          Uses similar options as record, but only reads an existing trace.\n"
 		"          -s : extract the snapshot instead of the main buffer\n"
+		"          -B : extract a given buffer (more than one may be specified)\n"
+		"          -t : include the top level buffer (useful with -B)\n"
 	},
 	{
 		"stop",
-- 
1.9.1


  reply	other threads:[~2015-04-22  4:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22  4:55 [PATCH v3 0/5] trace-cmd: Improve multi-instance support Howard Cochran
2015-04-22  4:55 ` Howard Cochran [this message]
2015-04-22  4:55 ` [PATCH v3 2/5] trace-cmd extract: Add -a option for all instances Howard Cochran
2015-04-22  4:55 ` [PATCH v3 3/5] trace-cmd stop, reset, restart: Add -a " Howard Cochran
2015-04-22  4:55 ` [PATCH v3 4/5] trace-cmd snapshot: Fully support multiple instances Howard Cochran
2015-04-22  4:55 ` [PATCH v3 5/5] trace-cmd stat: Support -a for all buffers. Update docs Howard Cochran

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=7b18a3f624fd1e864a86c0cee2079587953fa5ee.1429677461.git.hcochran@kernelspring.com \
    --to=hcochran@kernelspring.com \
    --cc=cochran@lexmark.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®