top.py: make number of lines a parameter

top.py currently hard-coded the number of top threads shown to 20.
This patch adds a parameter, "-l" (or "--lines") allowing to change
this default. This is useful for example if you intend to dump the
output of top.py to a file, in which case there is no reason to limit
it to 20 threads, and you can just as easily ask for 500.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: remove extra newline

Remove an extra blank line that was only printed when there are
several CPUs.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: add migration counts

Add to the per-thread statistics also a counter of CPU migrations of
this thread.

Also add to top.py -s display of each thread's overall count of
migrations, and the number of migrations per second during the
last refresh interval.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: add per-thread preemption statistics

This patch adds a per-thread counter of the number of times this thread
was preempted - i.e., the thread was still runable but nevertheless
was scheduled out.

It also adds this counter and its rate to top.py -s (--switches).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>