Skip to content
Snippets Groups Projects
  1. Jan 10, 2014
    • Nadav Har'El's avatar
      clock: add monotonic uptime clock · 8dffa912
      Nadav Har'El authored
      
      This patch starts to solve both issue #142 ("Support MONOTONIC_CLOCK")
      and issue #81 (use <chrono> for time).
      
      First, it adds an uptime() function to the "clock" interface, and
      implements it for kvm/xen/hpet by returning the system time from which
      we subtract the system time at boot (but not adding any correction
      for wallclock).
      
      Second, it adds a new std::chrono-based interface to this clock, in
      a new header file <osv/clock.hh>. Instead of the old-style
      clock::get()->uptime(), one should prefer osv::clock::uptime::now().
      This returns a std::chrono::time_point which is type-safe, in the
      sense that: 1. It knows what its epoch is (i.e., that it belongs to
      osv::clock::uptime), and 2. It knows what its units are (nanoseconds).
      This allows the compiler to prevent a user from confusing measurements
      from this clock with those from other clocks, or making mistakes in
      its units.
      
      Third, this patch implements clock_gettime(MONOTONIC_CLOCK), using
      the new osv::clock::uptime::now().
      
      Note that though the new osv::clock::uptime is almost identical to
      std::chrono::steady_clock, they should not be confused. The former is
      actually OSv's implementation of the latter: steady_clock is implemented
      by the C++11 standard library using the Posix clock_gettime, and that
      is implemented (in this patch) using osv::clock::uptime.
      
      With this patch, we're *not* done with either issues #142 or #81.
      For issue #142, i.e., for supporting MONOTONIC_CLOCK in timerfd, we
      need OSv's timers to work on uptime(), not on clock::get()->time().
      For issue #81, we should add a osv::clock::wall type too (similar to
      what clock::get()->time() does today, but more correctly), and use either
      osv::clock::wall or osv::clock::uptime everywhere that
      clock::get()->time() is currently used in the code.
      clock::get()->time() should be removed.
      
      Reviewed-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      8dffa912
    • Tomasz Grabiec's avatar
      build: incremental make without image= argument should use the default · 5c68e049
      Tomasz Grabiec authored
      
      Currently the parameter was read from the generated Makefile which was
      not re-generated on incremental build. The fix is to move the default
      to build.mk, this way the default will always be picked unless masked
      by command line argument.
      
      Fixes #153
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      5c68e049
  2. Jan 09, 2014
  3. Jan 08, 2014
  4. Jan 07, 2014
  5. Jan 06, 2014
  6. Jan 03, 2014
Loading