top.py: rewrite to make it easier to add and configure columns

top.py was written with a hard-coded set of columns, and adding new columns
was messy and caused a lot of code repetition. Worse, the code for the "-s"
option allowing to turn off a subset of the columns was ugly, and we could
hardly ever expand it to more combinations of columns or even controlling
the appearance or disappearance of individual columns.

So this patch rewrites most of top.py in a cleaner way. We now start with a
definition of all supported columns, each defined by a "source" field from the
REST api (e.g., "cpu_ms", "name", etc.), and various transformations on it.
Then, according to the command-line arguments we select a list of columns.
Finally we have code to render any selected set of columns.

This patch also adds two new options to top.py:

'-i' (--idle) shows the idle threads as normal threads (idle0, idle1, ...)
instead of summarizing the idle percentage on top. This is useful if you
want to see more statistics on the idle thread - such as the number of
switches, the average microseconds ran at each switch, etc.

'-p' (--period) allows changing the number of seconds to wait between
refreshes. E.g, "-p 10" refreshes every 10 seconds, and "-p 0.5"
refreshes every half a second. Remember that the rates shown (e.g.,
"switches/second") are always scaled per second - regardless of the
refresh period.

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