[PATCH] trace-cmd record: Fix -m option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 lib/trace-cmd/trace-recorder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index 20deb31c0897..f387091f5177 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -287,8 +287,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)
-- 
2.35.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux