]> git.lttng.org Git - lttng-tools.git/commitdiff
Tests: Add subbuf_size and subbuf_count options for channels
authorKienan Stewart <kstewart@efficios.com>
Wed, 13 Nov 2024 15:56:50 +0000 (10:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Dec 2024 18:34:53 +0000 (13:34 -0500)
Change-Id: I374dd4d1f9c501570dacd5f6e1abd90d6f383f62
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/lttngtest/lttng.py

index 31575a68ee8e6f94b06c58faadcef99aac41c667..6bccb9126b56cd075b9facba494786468462ad56 100644 (file)
@@ -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):
This page took 0.030426 seconds and 4 git commands to generate.