eventfd2: provide it as an alias for eventfd

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: added pthread_rwlockattr_destroy()/init() emtpy wrappers.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: fix no-cpu case

A sched::thread object can be created and not start()ed.
We often have two such unstarted threads created for itimer when this
feature is not used by the application.

Such a thread has no CPU, and currently top.py prints is as an ugly
"4294967295" for these threads which ruins the nice column alignment.
This patch changes this case to print "-" as the CPU instead.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[ penberg: Use hexadecimal constant ]
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: add "-s" option for context-switch statistics

This patch adds to top.py the ability to show per-thread statistics
on the number of times it was context-switched in, and the average
cpu time it got per switch, over the last refresh period. For
example:

   ID CPU  %CPU    TIME     sw     sw/s us/sw NAME
  478   0   2.9    0.39    630     38.0   763 >>>>>>>java.so

"sw", 630, is the total number of times this thread was ever switched
in. "sw/s", 38.0, is the number of switches per second in the last
refresh period. In each of the time slices in the last refresh period,
the thread ran for an average of 763 microseconds before being either
preempted or voluntarily giving up the CPU (by waiting or yielding).

To reduce users' information overload, the switching information is not
displayed by top.py by default, and the user needs to pass the "-s"
(or "--switches" option) to enable it.

This feature can be useful in understanding the scheduling behavior of
a workload and the function of individual threads. For example, in one
particular Cassandra read-only workload on one CPU, I see the virtio-net-rx
thread being switched in 13,000 times a second running only 2 microseconds
each; I then see 12 Java worker threads each being scheduled only 30 times
a second and doing a fairly large amount of work (around 800 microseconds);
I then see dozens of other Java threads each scheduled very frequently
(over 600 times a second) and doing very little work (20 microseconds) -
presuably the latter threads just read a request and dispatch it to the
worker threads.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "top.py: add "-s" option for context-switch statistics"

This reverts commit 3ad9c8c9d9fecb887441b6e607a04daf373277b3. It depends
on a patch that isn't merged.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http server: Adds reboot API

This adds a reboot option to the API.

To check do a
POST: http://localhost:8000/os/reboot

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
[ penberg: Fix formatting. ]
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http server: ifconfig to return MAC address

To return the interface MAC address, the libtools interface definition
was added a phys_addr parameter, the interface is passed now for the
set_intrface info method, this will allow settting additional parameters
that are not in the ifnet structure.

An equivelent parameter was added to the API and is now return with a
call to:
http://localhost:8000/network/ifconfig/

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>