diff --git a/backport-Fix-m-option-limit.patch b/backport-Fix-m-option-limit.patch new file mode 100644 index 0000000000000000000000000000000000000000..92dba66e12ef17d51b71d8a20a2e66ff25196a79 --- /dev/null +++ b/backport-Fix-m-option-limit.patch @@ -0,0 +1,42 @@ +From d3fcd3415c60995784dbedda8e92d0f880a871b8 Mon Sep 17 00:00:00 2001 +From: Steven Rostedt +Date: Wed, 27 Dec 2023 11:37:43 +0800 +Subject: [PATCH] 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. + +Signed-off-by: Steven Rostedt (Google) + +--- + 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 c811028..d133d9a 100644 +--- a/lib/trace-cmd/trace-recorder.c ++++ b/lib/trace-cmd/trace-recorder.c +@@ -353,8 +353,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.37.0.windows.1 + diff --git a/trace-cmd.spec b/trace-cmd.spec index 4f7153039700da5d42e3120dfc3bb9394c04557c..b777e6cd6a6f3642b85e56a7647d51cffce578fa 100644 --- a/trace-cmd.spec +++ b/trace-cmd.spec @@ -1,6 +1,6 @@ Name: trace-cmd Version: 2.9.2 -Release: 12 +Release: 13 Summary: A front-end for Ftrace License: GPLv2 and LGPLv2 URL: http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary @@ -15,6 +15,7 @@ Patch0005: backport-Changing-default-install-path-of-plugins.patch Patch0006: backport-Fix-broken-profile-command.patch Patch0007: backport-trace-cmd-stream-Set-default-sleep-time-to-half-a-se.patch Patch0008: backport-trace-cmd-record-Set-sleep_time-to-zero-at-end-of-re.patch +Patch0009: backport-Fix-m-option-limit.patch BuildRequires: gcc xmlto asciidoc mlocate libxml2-devel chrpath BuildRequires: gtk2-devel glib2-devel desktop-file-utils libtraceevent-devel @@ -74,6 +75,9 @@ echo "%{_bindir}/%{name}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.co %{_mandir}/man5/* %changelog +* Wed Dec 27 2023 xulei - 2.9.2-13 +- Fix -m option + * Tue Dec 26 2023 meiyang666 - 2.9.2-12 - Fix spec file