Skip to content

Commit

Permalink
Timestamp: Add recent(), now_steady(), and recent_steady().
Browse files Browse the repository at this point in the history
The steady() functions return the current time as measured by a steady
clock: a monotonic clock that never moves backwards.  We call the clock
"steady" rather than "monotonic" or "up" because C++0x calls this clock the
steady_clock, and that's a good name.

The recent() functions return a cached copy of a recent now() or
now_steady().  At userlevel at the moment, these functions actually just
call now() or now_steady().  In the kernels, though, they will be faster
than now() or now_steady().

Signed-off-by: Eddie Kohler <[email protected]>
  • Loading branch information
kohler committed Aug 23, 2011
1 parent fdd2b39 commit a96e410
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 93 deletions.
3 changes: 3 additions & 0 deletions config-linuxmodule.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
/* Define if your Linux kernel has devinet_ioctl. */
#undef HAVE_LINUX_DEVINET_IOCTL

/* Define if your Linux kernel exports get_monotonic_coarse. */
#undef HAVE_LINUX_GET_MONOTONIC_COARSE

/* Define if your Linux kernel has inet_ctl_sock_create. */
#undef HAVE_LINUX_INET_CTL_SOCK_CREATE

Expand Down
16 changes: 16 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -11317,6 +11317,22 @@ $as_echo "$ac_cv_linux_netdev_rx_handler_register" >&6; }

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for get_monotonic_coarse kernel symbol" >&5
$as_echo_n "checking for get_monotonic_coarse kernel symbol... " >&6; }
if ${ac_cv_linux_get_monotonic_coarse+:} false; then :
$as_echo_n "(cached) " >&6
else
if grep "__ksymtab_get_monotonic_coarse" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_get_monotonic_coarse=yes
else ac_cv_linux_get_monotonic_coarse=no; fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_linux_get_monotonic_coarse" >&5
$as_echo "$ac_cv_linux_get_monotonic_coarse" >&6; }
if test $ac_cv_linux_get_monotonic_coarse = yes; then
$as_echo "#define HAVE_LINUX_GET_MONOTONIC_COARSE 1" >>confdefs.h

fi

CC="$save_cc"
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
Expand Down
8 changes: 8 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,14 @@ void f1(int64_t) { // will fail if long long and int64_t are the same type
AC_DEFINE(HAVE_LINUX_NETDEV_RX_HANDLER_REGISTER)
fi

AC_CACHE_CHECK([for get_monotonic_coarse kernel symbol], [ac_cv_linux_get_monotonic_coarse],
[if grep "__ksymtab_get_monotonic_coarse" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_get_monotonic_coarse=yes
else ac_cv_linux_get_monotonic_coarse=no; fi])
if test $ac_cv_linux_get_monotonic_coarse = yes; then
AC_DEFINE(HAVE_LINUX_GET_MONOTONIC_COARSE)
fi

CC="$save_cc"
CXX="$save_cxx"
CPPFLAGS="$save_cppflags"
Expand Down
4 changes: 2 additions & 2 deletions include/click/timerset.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ inline Timestamp
TimerSet::next_timer_expiry_adjusted() const
{
Timestamp e = _timer_expiry;
#if CLICK_USERLEVEL
#if TIMESTAMP_WARPABLE
if (likely(!Timestamp::warp_jumping())) {
#endif
if (_timer_stride >= 8 || e.sec() == 0)
Expand All @@ -102,7 +102,7 @@ TimerSet::next_timer_expiry_adjusted() const
e -= Timer::adjustment();
else
e -= Timer::adjustment() + Timer::adjustment();
#if CLICK_USERLEVEL
#if TIMESTAMP_WARPABLE
}
#endif
return e;
Expand Down
Loading

0 comments on commit a96e410

Please sign in to comment.