aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2022-11-15 15:35:02 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-11-15 15:50:22 -0500
commit83f5d28ee73784db38d02bdb64f089ea415430e9 (patch)
treec73bbc7a8ec5a6250c53ea2fd5a4c0e752c1a433
parenta8555c4fb73e9f1816d2bb2360117406039815d8 (diff)
downloadtrace-cmd-83f5d28ee73784db38d02bdb64f089ea415430e9.tar.gz
trace-cmd record: Fix -m option
The -m option limits the size of each per-cpu buffer to the value specified in kbs (or actually pages). That is, if -m 1000 is specified, then the size per cpu buffer should not be more that 1000 kbs. Since it is implemented in halfs, it is usually between half and the full amount. But since the buffer reads can use pipes, the increment of the page count needs to take that into consideration. Currently, it just increments the page count every time the count goes over the page size. But due to pipes, the size increment can be multiple pages (65k in fact), and this distorts the size. Have the page count increment via the actually size read and not just by one even if several pages were read at one go. Link: https://lore.kernel.org/linux-trace-devel/20221115153502.5253871c@gandalf.local.home Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--lib/trace-cmd/trace-recorder.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index 25c26def..c343aadf 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -409,8 +409,8 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size)
recorder->count += size;
if (recorder->count >= recorder->page_size) {
+ recorder->pages += recorder->count / recorder->page_size;
recorder->count = 0;
- recorder->pages++;
}
if (recorder->pages < recorder->max)