aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoward Cochran <hcochran@kernelspring.com>2015-04-21 02:10:49 -0400
committerSteven Rostedt <rostedt@goodmis.org>2015-06-10 15:05:42 -0400
commit7927947958d1a12efd6f9fe7707f937bb908ddbf (patch)
tree77e12851985bb241154e994a0c7502f99854ab32
parentf3d17ce138e023a6cb5bc0a18c4d2821f7439298 (diff)
downloadtrace-cmd-7927947958d1a12efd6f9fe7707f937bb908ddbf.tar.gz
trace-cmd extract: Add -B and -t for multiple instances
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. Link: http://lkml.kernel.org/r/7b18a3f624fd1e864a86c0cee2079587953fa5ee.1429677461.git.hcochran@kernelspring.com Signed-off-by: Howard Cochran <hcochran@kernelspring.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-record.c20
-rw-r--r--trace-usage.c6
2 files changed, 17 insertions, 9 deletions
diff --git a/trace-record.c b/trace-record.c
index 6f514f3b..9dc0effb 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -525,17 +525,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");
+ }
}
}
@@ -3875,7 +3878,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);
@@ -4063,7 +4066,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 520b14b8..a708a851 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",