# type: () -> str
return self._name
- def add_channel(self, domain, channel_name=None):
- # type: (lttngctl.TracingDomain, Optional[str]) -> lttngctl.Channel
+ def add_channel(
+ self,
+ domain,
+ channel_name=None,
+ buffer_sharing_policy=lttngctl.BufferSharingPolicy.PerUID,
+ ):
+ # type: (lttngctl.TracingDomain, Optional[str], lttngctl.BufferSharingPolicy) -> lttngctl.Channel
channel_name = lttngctl.Channel._generate_name()
domain_option_name = _get_domain_option_name(domain)
self._client._run_cmd(
- "enable-channel --session '{session_name}' --{domain_name} '{channel_name}'".format(
+ "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="--buffers-uid"
+ if buffer_sharing_policy == lttngctl.BufferSharingPolicy.PerUID
+ else "--buffers-pid",
)
)
return _Channel(self._client, channel_name, domain, self)
# type: () -> None
self._client._run_cmd("destroy '{session_name}'".format(session_name=self.name))
+ def rotate(self, wait=True):
+ # type: (bool) -> None
+ self._client.rotate_session_by_name(self.name, wait)
+
@property
def is_active(self):
# type: () -> bool
name = name if name else lttngctl.Session._generate_name()
if isinstance(output, lttngctl.LocalSessionOutputLocation):
- output_option = "--output {output_path}".format(output_path=output.path)
+ output_option = "--output '{output_path}'".format(output_path=output.path)
elif output is None:
output_option = "--no-output"
else:
# type: () -> None
self._run_cmd("destroy --all")
+ def rotate_session_by_name(self, name, wait=True):
+ self._run_cmd(
+ "rotate '{session_name}' {wait_option}".format(
+ session_name=name, wait_option="-n" if wait is False else ""
+ )
+ )
+
+ def schedule_size_based_rotation(self, name, size_bytes):
+ # type (str, int) -> None
+ self._run_cmd(
+ "enable-rotation --session '{session_name}' --size {size}".format(
+ session_name=name, size=size_bytes
+ )
+ )
+
+ def schedule_time_based_rotation(self, name, period_seconds):
+ # type (str, int) -> None
+ self._run_cmd(
+ "enable-rotation --session '{session_name}' --timer {period_seconds}s".format(
+ session_name=name, period_seconds=period_seconds
+ )
+ )
+
@staticmethod
def _mi_find_in_element(element, sub_element_name):
# type: (xml.etree.ElementTree.Element, str) -> xml.etree.ElementTree.Element