From: Kienan Stewart Date: Wed, 13 Nov 2024 15:56:50 +0000 (-0500) Subject: Tests: Add subbuf_size and subbuf_count options for channels X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=47107ade064c51ed6c1ea06c26b526de9409d740;p=lttng-tools.git Tests: Add subbuf_size and subbuf_count options for channels Change-Id: I374dd4d1f9c501570dacd5f6e1abd90d6f383f62 Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- diff --git a/tests/utils/lttngtest/lttng.py b/tests/utils/lttngtest/lttng.py index 31575a68e..6bccb9126 100644 --- a/tests/utils/lttngtest/lttng.py +++ b/tests/utils/lttngtest/lttng.py @@ -512,8 +512,10 @@ class _Session(lttngctl.Session): domain, channel_name=None, buffer_sharing_policy=lttngctl.BufferSharingPolicy.PerUID, + subbuf_size=None, + subbuf_count=None, ): - # type: (lttngctl.TracingDomain, Optional[str], lttngctl.BufferSharingPolicy) -> lttngctl.Channel + # type: (lttngctl.TracingDomain, Optional[str], lttngctl.BufferSharingPolicy), Optional[str], Optional[str] -> lttngctl.Channel channel_name = lttngctl.Channel._generate_name() domain_option_name = _get_domain_option_name(domain) buffer_sharing_policy = ( @@ -521,18 +523,21 @@ class _Session(lttngctl.Session): if buffer_sharing_policy == lttngctl.BufferSharingPolicy.PerUID else "--buffers-pid" ) - self._client._run_cmd( - "enable-channel --session '{session_name}' --{domain_name} '{channel_name}' {buffer_sharing_policy}".format( - session_name=self.name, - domain_name=domain_option_name, - channel_name=channel_name, - buffer_sharing_policy=( - buffer_sharing_policy - if domain != lttngctl.TracingDomain.Kernel - else "" - ), - ) - ) + args = [ + "enable-channel", + "--session", + self.name, + "--{}".format(domain_option_name), + channel_name, + ] + if domain != lttngctl.TracingDomain.Kernel: + args.append(buffer_sharing_policy) + if subbuf_size is not None: + args.extend(["--subbuf-size", str(subbuf_size)]) + if subbuf_count is not None: + args.extend(["--num-subbuf", str(subbuf_count)]) + + self._client._run_cmd(" ".join([shlex.quote(x) for x in args])) return _Channel(self._client, channel_name, domain, self) def add_context(self, context_type):