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 = (
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):