diff --git a/lisa/trace.py b/lisa/trace.py index 385dd061cbef0e8e084b4e03442d0e154e33d700..fe6d815165577a619adf5f728fe059cfffdef6f5 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -4296,8 +4296,6 @@ class Trace(Loggable, TraceBase): The names or PIDs are listed in appearance order. """ - - # Keep only the values, in appearance order according to the timestamp # index def finalize(df, key_col, value_col, key_type, value_type): @@ -4325,32 +4323,20 @@ class Trace(Loggable, TraceBase): mapping_df.rename({name_col: 'name', pid_col: 'pid'}, axis=1, inplace=True) mapping_df_list.append(mapping_df) + events = set() def load(event, *args, **kwargs): - # All events have a __comm and __pid columns, so use it as well - _load(event, '__comm', '__pid') - _load(event, *args, **kwargs) - - # Import here to avoid circular dependency - # pylint: disable=import-outside-toplevel - from lisa.analysis.load_tracking import LoadTrackingAnalysis - # All events with a "comm" and "pid" column - events = { - 'sched_wakeup', - 'sched_wakeup_new', - *LoadTrackingAnalysis._SCHED_PELT_SE_NAMES, - } - for event in events: - # Test each event independently, to make sure they will be parsed - # if necessary + events.add(event) if event in self.available_events: - load(event, 'comm', 'pid') + _load(event, *args, **kwargs) + + load('task_rename', 'oldcomm', 'pid') + load('task_rename', 'newcomm', 'pid') - if 'sched_switch' in self.available_events: - load('sched_switch', 'prev_comm', 'prev_pid') - load('sched_switch', 'next_comm', 'next_pid') + load('sched_switch', 'prev_comm', 'prev_pid') + load('sched_switch', 'next_comm', 'next_pid') if not mapping_df_list: - raise MissingTraceEventError(sorted(events) + ['sched_switch'], available_events=self.available_events) + raise MissingTraceEventError(sorted(events), available_events=self.available_events) df = pd.concat(mapping_df_list) # Sort by order of appearance @@ -4358,20 +4344,6 @@ class Trace(Loggable, TraceBase): # Remove duplicated name/pid mapping and only keep the first appearance df = df_deduplicate(df, consecutives=False, keep='first', cols=['name', 'pid']) - forbidden_names = { - # is invented by trace-cmd, no event field contain this - # value, so it's useless (and actually harmful, since it will - # introduce a task that cannot be found in that trace) - '', - # This name appears when trace-cmd could not resolve the task name. - # Ignore it since it's not a valid name, and we probably managed - # to resolve it by looking at more events anyway. - '<...>', - # sched entity PELT events for task groups will get a comm="(null)" - '(null)', - } - df = df[~df['name'].isin(forbidden_names)] - name_to_pid = finalize(df, 'name', 'pid', str, int) pid_to_name = finalize(df, 'pid', 'name', int, str) diff --git a/tests/test_trace.py b/tests/test_trace.py index 833adbbdaee64f074e669e96dad51859ae72c4ee..42f9e88f23e61d08b378449e600db0a7e1d659af 100644 --- a/tests/test_trace.py +++ b/tests/test_trace.py @@ -118,7 +118,7 @@ class TestTrace(TraceTestCase): def test_get_task_name_pids(self): for name, pids in [ ('watchdog/0', [12]), - ('sh', [1642, 1702, 1714, 1717, 1718]), + ('sh', [1642, 1702, 1717, 1718]), ]: assert self.trace.get_task_name_pids(name) == pids