sched: add tracepoint for wakeup IPIs

Add a tracepoint "sched_ipi" for IPIs sent to wake up a thread on a
remote CPU.

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

Add a tracepoint "sched_yield" for sched::thread::yield(), sched_yield()
or pthread_yield() calls, and a second tracepoint "sched_yield_switch"
when the yield operation actually yielded (i.e., there was another
thread in the run queue).

Some sources on the Web suggest that Java uses sched_yield() heavily
and yield's behavior makes a big difference (see issue #482).
However, with this tracepoint, I disproved this conjecture when it
comes to workloads that interest us: For example, in Cassandra,
yield() is rarely used (10 times a second most of the time, 1000 times
a second in rare cases), and when it is used, there is usually no other
thread to yield to and we never see more than a couple of sched_yield_switch
occurances per second. So the implementation of yield() is of no
consequence for Cassandra's performance.

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

Add a tracepoint "sched_sched" for scheduler runs. Note that
scheduler may decide to do nothing (continuing to run the current
thread), so the sched_switch frequency is <= the sched_sched frequency.

Showing the frequency of both sched_sched and sched_switch in one
example workload (Cassandra), I noticed that in about half of the
reschedule calls we decide not to context switch. This suggests it
might be a good idea to optimize this case, to realise as quickly as
possible there is nothing to do. We already try to return quickly,
but maybe we can do this even more quickly.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests:remove unused code in misc-timeslice.cc

The _loop function is no long used here,so remove it.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Haifeng Gao <gaohaifeng.gao@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>