summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c661f2f)
Add BufferSharingPolicy which can be used with the add_channel method of
a Session to create per-pid channels.
This is done to allow tests for the per-pid buffer sharing mode to be
written using the python utils.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ice3b5d3a8db69c95aaa632c45f42069ab2be590c
# type: () -> str
return self._name
# 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(
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,
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)
)
)
return _Channel(self._client, channel_name, domain, self)
return "<%s.%s>" % (self.__class__.__name__, self.name)
return "<%s.%s>" % (self.__class__.__name__, self.name)
+@enum.unique
+class BufferSharingPolicy(enum.Enum):
+ """Buffer sharing policy."""
+
+ PerUID = "Per-UID buffering"
+ PerPID = "Per-PID buffering"
+
+ def __repr__(self):
+ return "<%s.%s>" % (self.__class__.__name__, self.name)
+
+
class EventRule(abc.ABC):
"""Event rule base class, see LTTNG-EVENT-RULE(7)."""
class EventRule(abc.ABC):
"""Event rule base class, see LTTNG-EVENT-RULE(7)."""
- def add_channel(self, domain, channel_name=None):
- # type: (TracingDomain, Optional[str]) -> Channel
+ def add_channel(
+ self,
+ domain,
+ channel_name=None,
+ buffer_sharing_policy=BufferSharingPolicy.PerUID,
+ ):
+ # type: (TracingDomain, Optional[str], BufferSharingPolicy) -> Channel
"""Add a channel with default attributes to the session."""
pass
"""Add a channel with default attributes to the session."""
pass