simpleperf: handle monitored processes correctly when a cpu is up.

For stat/record cmd, the way to handle -p option is to change the
process list into a thread list before profiling. However, it doesn't
work well if we want to open new event files when a cpu is up. The
situation in problem is as below:

1. Monitor for process A, which currently has thread a.
2. Then we open event files for thread a.
3. Process A creates thread b. If profiling child threads/processes
is enabled, the kernel will monitor thread b automatically.
4. A new cpu is up, and we need to open new event files on that
cpu. But we will only open event file for thread a, although the
user command is to monitor the whole process.

To fix this, remember which processes are monitored in
EventSelectionSet, and search threads in the monitored processes
each time to open new event files.

Bug: http://b/29245608
Test: run simpleperf record cmd and make cpu offline and online.
Test: run simpleperf_unit_test.
Change-Id: Iabf9e30be9f0bc5a3651227e4695034c0b9e0258
6 files changed