modules: Remove httpserver.so from mgmt

httpserver.so does not build propery for many:

  LINK httpserver
  /usr/bin/ld: cannot find -lboost_system-mt
  /usr/bin/ld: cannot find -lboost_filesystem-mt
  /usr/bin/ld: cannot find -lboost_program_options-mt
  collect2: error: ld returned 1 exit status

drop it from osv.git build until it does.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Document clock::time() and fix its implementation on kvmclock

Our clock::time() function returns the current wall-clock time (number of
nanoseconds since the Unix epoch). We never clearly documented this, so this
patch adds this documentation.

Moreover, in kvmclock, we assumed that the host never adjusts its
wall-clock time, which is not a good assumption because it prevents us
from benefiting from NTP running on the host. As Avi Kivity explains:

   "For the wall clock, you need to sample the wall clock base every time,
    since it can be changed by the host."

So this patch changes kvmclock::time() to sample the wall-clock-at-boot
reported by the paravirtual clock, on every time() call, and not just once.

The downsite of this patch is that clock::get::time(), and therefore
nanotime(), become a bit slower on kvmclock, as they need to sample
the wall_clock_boot() every time, require a couple of barriers and
arithmetic operations. But note that we shouldn't even be using the
non-monotonic clock::get::time() for our timers - we should be using the
monotonic clock::get::uptime() - and when we switch to using that we'll
get back the bit of performance lost in this patch.

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

It's a left over which is not used any more.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: improve help

 - added command descriptions
 - improved clarity of options
 - extracted argument groups
 - changed command help to start with lower case letter

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: exit silently when stdout pipe is broken

When output is not fully consumed because of piping, eg to `head`,
we get an ugly exception:

 Traceback (most recent call last):
   File "scripts/trace.py", line 274, in <module>
     args.func(args)
   File "scripts/trace.py", line 227, in list_timed
     bt_formatter(t.backtrace),
 IOError: [Errno 32] Broken pipe

Let's ignore it, it's normal condition.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: add `summary` command

Prints output like this:

Collected 36843 samples spanning 8.85 s

Tracepoint statistics:

  name              count
  ----              -----
  sched_wait        18420
  sched_wait_ret    18423

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: use call-site instead of return-site in flat backtrace

The call-graph tree is already using call-sites, this makes also
`trace.py list -b` also use it.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: move trace related commands from loader.py to trace.py

Removing 'osv trace summary' and 'osv trace duration' commands from
loader.py. The first is added as 'trace.py summary --timed', the
second one is added as 'trace.py list-timed'.

It was easier to move both in one commit as they are coupled with each
other.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: move TimeRange from prof.py to trace.py

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: make time slicing options available in trace listing

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: introduce '--period' time slicing option

This:

  --since 10.0 --period 100ms

is now equivalent to:

  --since 10.0 --until 10.1

This option makes it easier to slice the time based on the output of
'trace.py list-timed' which prints trace timestamp and duration.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: accept time units in --since and --until

The timestamp typically will come from 'trace.py list' output.  This
change makes it easier to paste the timestamp. Listing prints the time
with '.' separating seconds from nanoseconds.  The options '--since'
and '--until' accept timestamp in nanoseconds so the dot must have
been removed. Now one only needs to append the 's' suffix which
changes the unit to seconds.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: make -t option required for prof command

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: get rid of unnecessary int_or_none()

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
osv/clock.hh: Add std::chrono::duration literals

In <drivers/clock.hh> we had support for time literals looking like 100_ns,
100_us, 100_ms, 100_s. These simply translated to an integer number of
nanoseconds.

Added to <osv/clock.hh> similar literals, but using strongly-typed
std::chrono::duration, so that 100_ms translates to
std::chrono::milliseconds(100), and this is, as usual, automatically
scaled by the compiler to other units when other units (e.g., nanoseconds)
are required.

Because the literals of <drivers/clock.hh> and <osv/clock.hh> have the
same name, to use the latter you need to explicitly enable them in a scope
using the statement

    using namespace osv::clock::literals;

One the entire codebase is converted to use <osv/clock.hh> and std::chrono,
the old literals from <drivers/clock.hh> should be removed.

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

Add a type-safe std::chrono interface to the wall-clock time. E.g., use
use osv::clock::wall::now() to get an std::chrono::time_point instead
of clock::get()->time() which returns an s64.

This patch also changes clock_gettime(CLOCK_REALTIME) and gettimeofday()
to use the new osv::clock::wall::now() interface.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: fix help text of 'trace.py summary'

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: get rid of extra new-line in 'list-timed' output

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
gdb: fix 'osv info thread' thread address printout

Print the thread pointer, not the address of the thread pointer.

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