trace-cmd profile: Save starts on individual lists

When missed events happen on a cpu we need to clear (erase) the start
data for matched events. That is, paired events like irq enter and leave
use a "start" data saved when the irq enter happens and when the matching
leave occurs, it searches for the start to record the time between the two
events.

But when events are dropped, we have no idea if a start is orphaned,
where the mated event was dropped and the start will sit in memory
forever. Or worse, not only the mated event is dropped, but another
start is dropped and when the new mated event comes in, it may calculate
the time against the orphaned start and skew the recording.

When the events are dropped, the corresponding starts are freed and
removed. Some events only stay on the same CPU, which means we only
need to remove starts for that CPU. If an event can migrate, we can
not take the risk and remove starts that are associated to migrating
events.

Currently this is done with a big list. But this can be time consuming
if there are several starts on other CPUS that are associated with events
that do not migrate. We still search those starts for all missed events.

Instead, create nr_CPUs + 1 lists to hold starts that are associated to
events that can migrate, and for starts associated to events that are
pinned to a CPU. This should improve the performance.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 file changed