Skip to content

Commit

Permalink
lisa.trace: Make event namespaces simple prefixes
Browse files Browse the repository at this point in the history
BREAKING CHANGE

Event names were previously constructed with f"{namespace}__{event}".
This commit changes it to f"{namespace}{event}" to allow using
namespaces in more circumstances.
  • Loading branch information
douglas-raillard-arm committed Oct 24, 2024
1 parent b03c349 commit 9c349c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lisa/datautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,7 @@ def _from_event(cls, event, fields=None):
# for traces before the events from the lisa module got renamed to
# lisa__<event>
from lisa.trace import _NamespaceTraceView
events = _NamespaceTraceView._do_expand_namespaces(event, namespaces=('lisa', None))
events = _NamespaceTraceView._do_expand_namespaces(event, namespaces=('lisa__', None))

for event in events:
try:
Expand Down
17 changes: 6 additions & 11 deletions lisa/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2896,7 +2896,7 @@ def get_view(self, **kwargs):
:param events_namespaces: List of namespaces of the requested events.
Each namespace will be tried in order until the event is found. The
``None`` namespace can be used to specify no namespace. The full
event name is formed with ``<namespace>__<event>``.
event name is formed with ``<namespace><event>``.
:type events_namespaces: list(str or None)
:param events: Preload the given events when creating the view. This
Expand Down Expand Up @@ -3698,7 +3698,7 @@ def trace_state(self):
@memoized
def events_namespaces(self):
"""
Namespaces evens will be looked up in.
Namespaces events will be looked up in.
"""
try:
base_namespaces = self.base_trace.events_namespaces
Expand Down Expand Up @@ -3731,15 +3731,10 @@ def _do_expand_namespaces(cls, event, namespaces):

def expand_namespace(event, namespace):
if namespace:
if namespace.endswith('_'):
ns_prefix = namespace
else:
ns_prefix = f'{namespace}__'

if event.startswith(ns_prefix):
if event.startswith(namespace):
return event
else:
return f'{ns_prefix}{event}'
return f'{namespace}{event}'
else:
return event

Expand Down Expand Up @@ -6291,7 +6286,7 @@ def _view_from_user_kwargs(cls,
normalize_time=False,
strict_events=False,
events=None,
events_namespaces=('lisa', None),
events_namespaces=('lisa__', None),

sanitization_functions=None,
write_swap=None,
Expand Down Expand Up @@ -7449,7 +7444,7 @@ class FtraceCollector(CollectorBase, Configurable):
TOOLS = ['trace-cmd']
_COMPOSITION_ORDER = 0

def __init__(self, target, *, events=None, functions=None, buffer_size=10240, output_path=None, autoreport=False, trace_clock=None, saved_cmdlines_nr=8192, tracer=None, kmod_auto_load=True, events_namespaces=('lisa', None), **kwargs):
def __init__(self, target, *, events=None, functions=None, buffer_size=10240, output_path=None, autoreport=False, trace_clock=None, saved_cmdlines_nr=8192, tracer=None, kmod_auto_load=True, events_namespaces=('lisa__', None), **kwargs):

kconfig = target.plat_info['kernel']['config']
if not kconfig.get('FTRACE'):
Expand Down

0 comments on commit 9c349c3

Please sign in to comment.