utils/trace: make Task-PID mapping more robust

Currently we use sched_switches next_comm/next_pid fields to build the
PID map. However, it could happen that a task exits after its name has
been changed, thus never being reported with the correct name.

For example this happens when a father task spawns a cpu hog thread and
then sets its thread name. If this child runs till completion, it will
never be switched in again while it will still be switched out when it
die.

Let's assume that all the tasks we mainly care about in a test always
complet (at least one time) while the trace is being collected.
Thus, a better strategy is to parse the prev_comm/prev_pid fields of
each sched_switch event.

Reported-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
diff --git a/libs/utils/trace.py b/libs/utils/trace.py
index 4e2df41..3efd309 100644
--- a/libs/utils/trace.py
+++ b/libs/utils/trace.py
@@ -294,7 +294,7 @@
             self._scanTasks(df, name_key=name_key, pid_key=pid_key)
 
         if 'sched_switch' in self.available_events:
-            load('sched_switch', 'next_comm', 'next_pid')
+            load('sched_switch', 'prev_comm', 'prev_pid')
             return
 
         if 'sched_load_avg_task' in self.available_events: