Skip to contentSkip to conversation

trace: fix wrong help information about snapshot

PATCH In review Wang YanQing 2 participants 2 messages Sep 12, 2013 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace: fix wrong help information about snapshot

Cat snapshot give me:
" tracer: nop

* Snapshot is freed *

Snapshot commands:
echo 0 > snapshot : Clears and frees snapshot buffer
echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
Takes a snapshot of the main buffer.
echo 2 > snapshot : Clears snapshot buffer (but does not allocate)
(Doesn't have to be '2' works with any number that
is not a '0' or '1')"

But after read the code, I found the right information about "echo 2 > snapshot" should looks like below:

" echo 2 > snapshot : Clears snapshot buffer (but does not free)
(Doesn't have to be '2' works with any number that
is not a '0' or '1')"

---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 7974ba2..d0da660 100644
@@ -2760,7 +2760,7 @@ static void show_snapshot_main_help(struct seq_file *m)
 	seq_printf(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n");
 	seq_printf(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.\n");
 	seq_printf(m, "#                      Takes a snapshot of the main buffer.\n");
-	seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not allocate)\n");
+	seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not free)\n");
 	seq_printf(m, "#                      (Doesn't have to be '2' works with any number that\n");
 	seq_printf(m, "#                       is not a '0' or '1')\n");
 }
Signature · 1 line
1.7.12.4.dirty
maintainer
#1 lore raw
Quoted 14 lines · On Thu, 12 Sep 2013 23:04:01 +0800 Wang YanQing <[email protected]> wrote:

Cat snapshot give me:
" tracer: nop

* Snapshot is freed *

Snapshot commands:
echo 0 > snapshot : Clears and frees snapshot buffer
echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
Takes a snapshot of the main buffer.
echo 2 > snapshot : Clears snapshot buffer (but does not allocate)
(Doesn't have to be '2' works with any number that
is not a '0' or '1')"

Quoted 6 lines

But after read the code, I found the right information about "echo 2 > snapshot" should looks like below:

" echo 2 > snapshot : Clears snapshot buffer (but does not free)
(Doesn't have to be '2' works with any number that
is not a '0' or '1')"

Actually, they both are correct:

	default:
		if (tr->allocated_snapshot) {
			if (iter->cpu_file == RING_BUFFER_ALL_CPUS)
				tracing_reset_online_cpus(&tr->max_buffer);
			else
				tracing_reset(&tr->max_buffer,	iter->cpu_file);
		}
		break;
	}

It does nothing if it isn't allocated.

Perhaps we need it to say "(but does not allocate or free)"

-- Steve

Quoted 19 lines
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 7974ba2..d0da660 100644
@@ -2760,7 +2760,7 @@ static void show_snapshot_main_help(struct seq_file *m)
 	seq_printf(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n");
 	seq_printf(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.\n");
 	seq_printf(m, "#                      Takes a snapshot of the main buffer.\n");
-	seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not allocate)\n");
+	seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not free)\n");
 	seq_printf(m, "#                      (Doesn't have to be '2' works with any number that\n");
 	seq_printf(m, "#                       is not a '0' or '1')\n");
 }