trace: fix trace list-timed

Broken by commit 1e53a52f6664b0c53a3d867386565511efeae25a.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: unify timed trace extraction

The algorithm was duplicated between 'prof-wait','prof-lock' and 'list
timed','summary --timed'. This change unifies all paths.

As a side effect, mutex_lock_wait/mutex_lock_wake pair is now
recognized as timed sample and appears in 'summary --timed' and
'trace list-timed'

This refactoring will also make it easy to declare timed samples which
are correlated by data rather than calling thread.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: introduce 'prof-timed' command

This command shows a duration profile like 'prof-wait' or 'prof-lock'
but is more generic, it can work with any timed traces.

'trace prof-wait' is equivalent of 'trace prof-timed -t sched_wait'
'trace prof-lock' is equivalent of 'trace prof-timed -t mutex_lock_wait'

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: increase coverage of trace.py

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: make timed-trace recognition handle discontinuous streams properly

This change aims to reduce the likelihood of running into issue
merged stream may not be. If samples cross CPUs and the CPU of the
second sample has its earliest sample after the first sample, we
ignore that pair as the second sample has a high chance of belonging
to other pair.

This change does not solve the problem completly because there may be
a situation when sample which was recorded on another CPU was
discarded and the next sample will be again on the first CPU.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>