mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-04 10:10:59 +00:00
timeout: use uint64_t for all plain time values
This enforces the use of unsigned 64-bit values for time in the duration type, the timeout framework, the timer session, the userland timer-drivers, and the alarm framework on all platforms. The commit also adapts the code that uses these tools accross all basic repositories (base, base-*, os. gems, libports, ports, dde_*) to use unsigned 64-bit values for time as well as far as this does not imply profound modifications. Fixes #3208
This commit is contained in:
parent
e072ee480b
commit
181c78d482
@ -130,7 +130,7 @@ struct Main
|
||||
log("start measurement ...");
|
||||
timer.sigh(timer_signal.cap);
|
||||
|
||||
auto measure = [&] (unsigned duration_sec) {
|
||||
auto measure = [&] (uint64_t duration_sec) {
|
||||
timer.trigger_once(duration_sec * 1000 * 1000);
|
||||
synchronizer.synchronize();
|
||||
timer_signal.receive();
|
||||
|
@ -37,11 +37,11 @@ Duration Timer::Time_source::curr_time()
|
||||
{
|
||||
struct timeval tv;
|
||||
lx_gettimeofday(&tv, 0);
|
||||
return Duration(Microseconds(tv.tv_sec * 1000 * 1000 + tv.tv_usec));
|
||||
return Duration(Microseconds((uint64_t)tv.tv_sec * 1000 * 1000 + tv.tv_usec));
|
||||
}
|
||||
|
||||
|
||||
void Timer::Time_source::_usleep(unsigned long us)
|
||||
void Timer::Time_source::_usleep(uint64_t us)
|
||||
{
|
||||
struct timespec ts;
|
||||
ts.tv_sec = us / (1000 * 1000);
|
||||
|
@ -22,7 +22,11 @@
|
||||
/* local includes */
|
||||
#include <threaded_time_source.h>
|
||||
|
||||
namespace Timer { class Time_source; }
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
class Time_source;
|
||||
}
|
||||
|
||||
|
||||
class Timer::Time_source : public Threaded_time_source
|
||||
@ -45,7 +49,7 @@ class Timer::Time_source : public Threaded_time_source
|
||||
}
|
||||
|
||||
Genode::addr_t _sem { ~0UL };
|
||||
unsigned long _timeout_us { 0 };
|
||||
uint64_t _timeout_us { 0 };
|
||||
unsigned long const _tsc_khz;
|
||||
Duration _curr_time { Microseconds(0) };
|
||||
Genode::Trace::Timestamp _tsc_start { Genode::Trace::timestamp() };
|
||||
@ -54,7 +58,7 @@ class Timer::Time_source : public Threaded_time_source
|
||||
/* 1 / ((us / (1000 * 1000)) * (tsc_khz * 1000)) */
|
||||
enum { TSC_FACTOR = 1000ULL };
|
||||
|
||||
inline Genode::uint64_t _tsc_to_us(Genode::uint64_t tsc) const
|
||||
inline uint64_t _tsc_to_us(uint64_t tsc) const
|
||||
{
|
||||
return (tsc) / (_tsc_khz / TSC_FACTOR);
|
||||
}
|
||||
@ -84,8 +88,8 @@ class Timer::Time_source : public Threaded_time_source
|
||||
|
||||
Microseconds max_timeout() const override
|
||||
{
|
||||
unsigned long long const max_us_ull = _tsc_to_us(~0ULL);
|
||||
return max_us_ull > ~0UL ? Microseconds(~0UL) : Microseconds(max_us_ull);
|
||||
uint64_t const max_us = _tsc_to_us(~(uint64_t)0);
|
||||
return max_us > ~(uint64_t)0 ? Microseconds(~(uint64_t)0) : Microseconds(max_us);
|
||||
}
|
||||
|
||||
Duration curr_time() override
|
||||
|
@ -26,7 +26,7 @@ class Genode::Alarm
|
||||
{
|
||||
public:
|
||||
|
||||
typedef unsigned long Time;
|
||||
typedef uint64_t Time;
|
||||
|
||||
private:
|
||||
|
||||
@ -38,7 +38,7 @@ class Genode::Alarm
|
||||
bool deadline_period;
|
||||
Time period; /* duration between alarms */
|
||||
|
||||
bool is_pending_at(unsigned long time, bool time_period) const;
|
||||
bool is_pending_at(uint64_t time, bool time_period) const;
|
||||
};
|
||||
|
||||
Lock _dispatch_lock { }; /* taken during handle method */
|
||||
@ -76,7 +76,7 @@ class Genode::Alarm
|
||||
* return value is 'true' and the alarm is periodically scheduled,
|
||||
* the alarm is scheduled again.
|
||||
*/
|
||||
virtual bool on_alarm(unsigned) { return false; }
|
||||
virtual bool on_alarm(uint64_t) { return false; }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -32,9 +32,9 @@ namespace Genode {
|
||||
*/
|
||||
struct Genode::Microseconds
|
||||
{
|
||||
unsigned long value;
|
||||
uint64_t value;
|
||||
|
||||
explicit Microseconds(unsigned long value) : value(value) { }
|
||||
explicit Microseconds(uint64_t value) : value(value) { }
|
||||
|
||||
void print(Output &out) const
|
||||
{
|
||||
@ -49,9 +49,9 @@ struct Genode::Microseconds
|
||||
*/
|
||||
struct Genode::Milliseconds
|
||||
{
|
||||
unsigned long value;
|
||||
uint64_t value;
|
||||
|
||||
explicit Milliseconds(unsigned long value) : value(value) { }
|
||||
explicit Milliseconds(uint64_t value) : value(value) { }
|
||||
|
||||
void print(Output &out) const
|
||||
{
|
||||
@ -76,11 +76,7 @@ struct Genode::Duration
|
||||
enum { MS_PER_HOUR = 1000UL * 60 * 60 };
|
||||
enum { US_PER_HOUR = 1000UL * 1000 * 60 * 60 };
|
||||
|
||||
unsigned long _microseconds { 0 };
|
||||
unsigned long _hours { 0 };
|
||||
|
||||
void _add_us_less_than_an_hour(unsigned long us);
|
||||
void _raise_hours(unsigned long hours);
|
||||
uint64_t _microseconds { 0 };
|
||||
|
||||
public:
|
||||
|
||||
|
@ -158,7 +158,7 @@ class Genode::Timeout : private Noncopyable
|
||||
|
||||
private:
|
||||
|
||||
typedef unsigned long Time;
|
||||
typedef uint64_t Time;
|
||||
|
||||
struct Raw
|
||||
{
|
||||
@ -166,7 +166,7 @@ class Genode::Timeout : private Noncopyable
|
||||
bool deadline_period;
|
||||
Time period;
|
||||
|
||||
bool is_pending_at(unsigned long time, bool time_period) const;
|
||||
bool is_pending_at(uint64_t time, bool time_period) const;
|
||||
};
|
||||
|
||||
Lock _dispatch_lock { };
|
||||
@ -188,7 +188,7 @@ class Genode::Timeout : private Noncopyable
|
||||
|
||||
void _alarm_reset() { _alarm_assign(0, 0, false, 0), _active = 0, _next = 0; }
|
||||
|
||||
bool _on_alarm(unsigned);
|
||||
bool _on_alarm(uint64_t);
|
||||
|
||||
Alarm(Alarm const &);
|
||||
Alarm &operator = (Alarm const &);
|
||||
|
@ -27,15 +27,15 @@ struct Timer::Session_client : Genode::Rpc_client<Session>
|
||||
explicit Session_client(Session_capability session)
|
||||
: Genode::Rpc_client<Session>(session) { }
|
||||
|
||||
void trigger_once(unsigned us) override { call<Rpc_trigger_once>(us); }
|
||||
void trigger_once(uint64_t us) override { call<Rpc_trigger_once>(us); }
|
||||
|
||||
void trigger_periodic(unsigned us) override { call<Rpc_trigger_periodic>(us); }
|
||||
void trigger_periodic(uint64_t us) override { call<Rpc_trigger_periodic>(us); }
|
||||
|
||||
void sigh(Signal_context_capability sigh) override { call<Rpc_sigh>(sigh); }
|
||||
|
||||
unsigned long elapsed_ms() const override { return call<Rpc_elapsed_ms>(); }
|
||||
uint64_t elapsed_ms() const override { return call<Rpc_elapsed_ms>(); }
|
||||
|
||||
unsigned long elapsed_us() const override { return call<Rpc_elapsed_us>(); }
|
||||
uint64_t elapsed_us() const override { return call<Rpc_elapsed_us>(); }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__TIMER_SESSION__CLIENT_H_ */
|
||||
|
@ -205,22 +205,22 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
|
||||
Timeout_handler *_handler { nullptr };
|
||||
Lock _real_time_lock { Lock::UNLOCKED };
|
||||
unsigned long _us { elapsed_us() };
|
||||
uint64_t _us { elapsed_us() };
|
||||
Timestamp _ts { _timestamp() };
|
||||
Duration _real_time { Microseconds(_us) };
|
||||
Duration _interpolated_time { _real_time };
|
||||
unsigned _interpolation_quality { 0 };
|
||||
unsigned long _us_to_ts_factor { 1UL };
|
||||
uint64_t _us_to_ts_factor { 1UL };
|
||||
unsigned _us_to_ts_factor_shift { 0 };
|
||||
|
||||
Timestamp _timestamp();
|
||||
|
||||
void _update_interpolation_quality(unsigned long min_factor,
|
||||
unsigned long max_factor);
|
||||
void _update_interpolation_quality(uint64_t min_factor,
|
||||
uint64_t max_factor);
|
||||
|
||||
unsigned long _ts_to_us_ratio(Timestamp ts,
|
||||
unsigned long us,
|
||||
unsigned shift);
|
||||
uint64_t _ts_to_us_ratio(Timestamp ts,
|
||||
uint64_t us,
|
||||
unsigned shift);
|
||||
|
||||
void _update_real_time();
|
||||
|
||||
@ -284,7 +284,7 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
* \noapi
|
||||
* \deprecated Use One_shot_timeout (or Periodic_timeout) instead
|
||||
*/
|
||||
void usleep(unsigned us) override
|
||||
void usleep(uint64_t us) override
|
||||
{
|
||||
if (_mode == MODERN) {
|
||||
throw Cannot_use_both_legacy_and_modern_interface();
|
||||
@ -322,7 +322,7 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
* \noapi
|
||||
* \deprecated Use One_shot_timeout (or Periodic_timeout) instead
|
||||
*/
|
||||
void msleep(unsigned ms) override
|
||||
void msleep(uint64_t ms) override
|
||||
{
|
||||
if (_mode == MODERN) {
|
||||
throw Cannot_use_both_legacy_and_modern_interface();
|
||||
|
@ -19,7 +19,12 @@
|
||||
#include <base/signal.h>
|
||||
#include <session/session.h>
|
||||
|
||||
namespace Timer { struct Session; }
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
|
||||
struct Session;
|
||||
}
|
||||
|
||||
|
||||
struct Timer::Session : Genode::Session
|
||||
@ -38,7 +43,7 @@ struct Timer::Session : Genode::Session
|
||||
/**
|
||||
* Program single timeout (relative from now in microseconds)
|
||||
*/
|
||||
virtual void trigger_once(unsigned us) = 0;
|
||||
virtual void trigger_once(uint64_t us) = 0;
|
||||
|
||||
/**
|
||||
* Program periodic timeout (in microseconds)
|
||||
@ -46,7 +51,7 @@ struct Timer::Session : Genode::Session
|
||||
* The first period will be triggered after 'us' at the latest,
|
||||
* but it might be triggered earlier as well.
|
||||
*/
|
||||
virtual void trigger_periodic(unsigned us) = 0;
|
||||
virtual void trigger_periodic(uint64_t us) = 0;
|
||||
|
||||
/**
|
||||
* Register timeout signal handler
|
||||
@ -56,32 +61,32 @@ struct Timer::Session : Genode::Session
|
||||
/**
|
||||
* Return number of elapsed milliseconds since session creation
|
||||
*/
|
||||
virtual unsigned long elapsed_ms() const = 0;
|
||||
virtual uint64_t elapsed_ms() const = 0;
|
||||
|
||||
virtual unsigned long elapsed_us() const = 0;
|
||||
virtual uint64_t elapsed_us() const = 0;
|
||||
|
||||
/**
|
||||
* Client-side convenience method for sleeping the specified number
|
||||
* of milliseconds
|
||||
*/
|
||||
virtual void msleep(unsigned ms) = 0;
|
||||
virtual void msleep(uint64_t ms) = 0;
|
||||
|
||||
/**
|
||||
* Client-side convenience method for sleeping the specified number
|
||||
* of microseconds
|
||||
*/
|
||||
virtual void usleep(unsigned us) = 0;
|
||||
virtual void usleep(uint64_t us) = 0;
|
||||
|
||||
|
||||
/*********************
|
||||
** RPC declaration **
|
||||
*********************/
|
||||
|
||||
GENODE_RPC(Rpc_trigger_once, void, trigger_once, unsigned);
|
||||
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, unsigned);
|
||||
GENODE_RPC(Rpc_trigger_once, void, trigger_once, uint64_t);
|
||||
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, uint64_t);
|
||||
GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
|
||||
GENODE_RPC(Rpc_elapsed_ms, unsigned long, elapsed_ms);
|
||||
GENODE_RPC(Rpc_elapsed_us, unsigned long, elapsed_us);
|
||||
GENODE_RPC(Rpc_elapsed_ms, uint64_t, elapsed_ms);
|
||||
GENODE_RPC(Rpc_elapsed_us, uint64_t, elapsed_us);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_trigger_once, Rpc_trigger_periodic,
|
||||
Rpc_sigh, Rpc_elapsed_ms, Rpc_elapsed_us);
|
||||
|
@ -666,8 +666,8 @@ class Genode::Register_set : Noncopyable
|
||||
|
||||
struct Microseconds
|
||||
{
|
||||
unsigned value;
|
||||
explicit Microseconds(unsigned value) : value(value) { }
|
||||
uint64_t value;
|
||||
explicit Microseconds(uint64_t value) : value(value) { }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -678,7 +678,7 @@ class Genode::Register_set : Noncopyable
|
||||
/**
|
||||
* Delay execution of the caller for 'us' microseconds
|
||||
*/
|
||||
virtual void usleep(unsigned us) = 0;
|
||||
virtual void usleep(uint64_t us) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -125,11 +125,11 @@ _ZN6Genode14env_deprecatedEv T
|
||||
_ZN6Genode14ipc_reply_waitERKNS_17Native_capabilityENS_18Rpc_exception_codeERNS_11Msgbuf_baseES5_ T
|
||||
_ZN6Genode15Alarm_scheduler12_setup_alarmERNS_5AlarmEmm T
|
||||
_ZN6Genode15Alarm_scheduler13next_deadlineEPm T
|
||||
_ZN6Genode15Alarm_scheduler17schedule_absoluteEPNS_5AlarmEm T
|
||||
_ZN6Genode15Alarm_scheduler17schedule_absoluteEPNS_5AlarmEy T
|
||||
_ZN6Genode15Alarm_scheduler18_get_pending_alarmEv T
|
||||
_ZN6Genode15Alarm_scheduler23_unsynchronized_dequeueEPNS_5AlarmE T
|
||||
_ZN6Genode15Alarm_scheduler23_unsynchronized_enqueueEPNS_5AlarmE T
|
||||
_ZN6Genode15Alarm_scheduler6handleEm T
|
||||
_ZN6Genode15Alarm_scheduler6handleEy T
|
||||
_ZN6Genode15Alarm_scheduler7discardEPNS_5AlarmE T
|
||||
_ZN6Genode15Alarm_scheduler8scheduleEPNS_5AlarmEm T
|
||||
_ZN6Genode15Alarm_schedulerD1Ev T
|
||||
|
@ -83,7 +83,7 @@ void Alarm_scheduler::_unsynchronized_dequeue(Alarm *alarm)
|
||||
}
|
||||
|
||||
|
||||
bool Alarm::Raw::is_pending_at(unsigned long time, bool time_period) const
|
||||
bool Alarm::Raw::is_pending_at(uint64_t time, bool time_period) const
|
||||
{
|
||||
return (time_period == deadline_period &&
|
||||
time >= deadline) ||
|
||||
@ -139,7 +139,7 @@ void Alarm_scheduler::handle(Alarm::Time curr_time)
|
||||
Alarm *curr;
|
||||
while ((curr = _get_pending_alarm())) {
|
||||
|
||||
unsigned long triggered = 1;
|
||||
uint64_t triggered = 1;
|
||||
|
||||
if (curr->_raw.period) {
|
||||
Alarm::Time deadline = curr->_raw.deadline;
|
||||
|
@ -16,75 +16,37 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
void Duration::_raise_hours(unsigned long hours)
|
||||
{
|
||||
unsigned long const old_hours = _hours;
|
||||
_hours += hours;
|
||||
if (_hours < old_hours) {
|
||||
throw Overflow(); }
|
||||
}
|
||||
|
||||
|
||||
void Duration::_add_us_less_than_an_hour(unsigned long us)
|
||||
{
|
||||
unsigned long const us_until_next_hr =
|
||||
(unsigned long)US_PER_HOUR - _microseconds;
|
||||
|
||||
if (us >= us_until_next_hr) {
|
||||
_raise_hours(1);
|
||||
_microseconds = us - us_until_next_hr;
|
||||
} else {
|
||||
_microseconds += us;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Duration::add(Microseconds us)
|
||||
{
|
||||
/* filter out hours if any */
|
||||
if (us.value >= (unsigned long)US_PER_HOUR) {
|
||||
unsigned long const hours = us.value / US_PER_HOUR;
|
||||
_raise_hours(hours);
|
||||
us.value -= hours * US_PER_HOUR;
|
||||
if (us.value > ~(uint64_t)0 - _microseconds) {
|
||||
throw Overflow();
|
||||
}
|
||||
/* add the rest */
|
||||
_add_us_less_than_an_hour(us.value);
|
||||
_microseconds += us.value;
|
||||
}
|
||||
|
||||
|
||||
void Duration::add(Milliseconds ms)
|
||||
{
|
||||
/* filter out hours if any */
|
||||
if (ms.value >= MS_PER_HOUR) {
|
||||
unsigned long const hours = ms.value / MS_PER_HOUR;
|
||||
_raise_hours(hours);
|
||||
ms.value -= hours * MS_PER_HOUR;
|
||||
if (ms.value > ~(uint64_t)0 / 1000) {
|
||||
throw Overflow();
|
||||
}
|
||||
/* add the rest as microseconds value */
|
||||
_add_us_less_than_an_hour(ms.value * US_PER_MS);
|
||||
add(Microseconds(ms.value * 1000));
|
||||
}
|
||||
|
||||
|
||||
bool Duration::less_than(Duration const &other) const
|
||||
{
|
||||
if (_hours != other._hours) {
|
||||
return _hours < other._hours; }
|
||||
|
||||
if (_microseconds != other._microseconds) {
|
||||
return _microseconds < other._microseconds; }
|
||||
|
||||
return false;
|
||||
return _microseconds < other._microseconds;
|
||||
}
|
||||
|
||||
|
||||
Microseconds Duration::trunc_to_plain_us() const
|
||||
{
|
||||
return Microseconds(_microseconds + (_hours ? _hours * US_PER_HOUR : 0));
|
||||
return Microseconds(_microseconds);
|
||||
}
|
||||
|
||||
|
||||
Milliseconds Duration::trunc_to_plain_ms() const
|
||||
{
|
||||
return Milliseconds(trunc_to_plain_us().value / 1000);
|
||||
return Milliseconds(_microseconds / 1000);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void Timeout::discard()
|
||||
** Timeout::Alarm **
|
||||
********************/
|
||||
|
||||
bool Timeout::Alarm::_on_alarm(unsigned)
|
||||
bool Timeout::Alarm::_on_alarm(uint64_t)
|
||||
{
|
||||
if (handler) {
|
||||
Handler *current = handler;
|
||||
@ -68,7 +68,7 @@ Timeout::Alarm::~Alarm()
|
||||
}
|
||||
|
||||
|
||||
bool Timeout::Alarm::Raw::is_pending_at(unsigned long time, bool time_period) const
|
||||
bool Timeout::Alarm::Raw::is_pending_at(uint64_t time, bool time_period) const
|
||||
{
|
||||
return (time_period == deadline_period &&
|
||||
time >= deadline) ||
|
||||
@ -83,12 +83,12 @@ bool Timeout::Alarm::Raw::is_pending_at(unsigned long time, bool time_period) co
|
||||
|
||||
void Alarm_timeout_scheduler::handle_timeout(Duration duration)
|
||||
{
|
||||
unsigned long const curr_time_us = duration.trunc_to_plain_us().value;
|
||||
uint64_t const curr_time_us = duration.trunc_to_plain_us().value;
|
||||
|
||||
_alarm_handle(curr_time_us);
|
||||
|
||||
/* sleep time is either until the next deadline or the maximum timout */
|
||||
unsigned long sleep_time_us;
|
||||
uint64_t sleep_time_us;
|
||||
Alarm::Time deadline_us;
|
||||
if (_alarm_next_deadline(&deadline_us)) {
|
||||
sleep_time_us = deadline_us - curr_time_us;
|
||||
@ -139,7 +139,7 @@ void Alarm_timeout_scheduler::_schedule_one_shot(Timeout &timeout,
|
||||
Microseconds duration)
|
||||
{
|
||||
/* raise timeout duration by the age of the local time value */
|
||||
unsigned long us = _time_source.curr_time().trunc_to_plain_us().value;
|
||||
uint64_t us = _time_source.curr_time().trunc_to_plain_us().value;
|
||||
if (us >= _now) {
|
||||
us = duration.value + (us - _now); }
|
||||
else {
|
||||
@ -294,7 +294,7 @@ void Alarm_timeout_scheduler::_alarm_handle(Alarm::Time curr_time)
|
||||
_pending_head = _pending_head->_next;
|
||||
curr->_next = nullptr;
|
||||
|
||||
unsigned long triggered = 1;
|
||||
uint64_t triggered = 1;
|
||||
|
||||
if (curr->_raw.period) {
|
||||
Alarm::Time deadline = curr->_raw.deadline;
|
||||
|
@ -19,8 +19,8 @@ using namespace Genode;
|
||||
using namespace Genode::Trace;
|
||||
|
||||
|
||||
void Timer::Connection::_update_interpolation_quality(unsigned long min_factor,
|
||||
unsigned long max_factor)
|
||||
void Timer::Connection::_update_interpolation_quality(uint64_t min_factor,
|
||||
uint64_t max_factor)
|
||||
{
|
||||
/*
|
||||
* If the factor gets adapted less than 12.5%, we raise the
|
||||
@ -35,9 +35,9 @@ void Timer::Connection::_update_interpolation_quality(unsigned long min_factor,
|
||||
}
|
||||
|
||||
|
||||
unsigned long Timer::Connection::_ts_to_us_ratio(Timestamp ts,
|
||||
unsigned long us,
|
||||
unsigned shift)
|
||||
uint64_t Timer::Connection::_ts_to_us_ratio(Timestamp ts,
|
||||
uint64_t us,
|
||||
unsigned shift)
|
||||
{
|
||||
/*
|
||||
* If the timestamp difference is to big to do the following
|
||||
@ -59,8 +59,8 @@ unsigned long Timer::Connection::_ts_to_us_ratio(Timestamp ts,
|
||||
* the calculation. This upscaling must be considered when using
|
||||
* the result.
|
||||
*/
|
||||
Timestamp const result = (ts << shift) / us;
|
||||
unsigned long const result_ul = (unsigned long)result;
|
||||
Timestamp const result = (ts << shift) / us;
|
||||
uint64_t const result_ul = (uint64_t)result;
|
||||
if (result != result_ul) {
|
||||
warning("Timestamp-to-time ratio too big");
|
||||
return ~0UL;
|
||||
@ -87,7 +87,7 @@ Duration Timer::Connection::_update_interpolated_time(Duration &interpolated_tim
|
||||
|
||||
void Timer::Connection::_handle_timeout()
|
||||
{
|
||||
unsigned long const us = elapsed_us();
|
||||
uint64_t const us = elapsed_us();
|
||||
if (us - _us > REAL_TIME_UPDATE_PERIOD_US) {
|
||||
_update_real_time();
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ void Timer::Connection::_update_real_time()
|
||||
* Update timestamp, time, and real-time value
|
||||
*/
|
||||
|
||||
Timestamp ts = 0UL;
|
||||
unsigned long us = 0UL;
|
||||
unsigned long latency_us = ~0UL;
|
||||
Timestamp ts = 0UL;
|
||||
uint64_t us = 0UL;
|
||||
uint64_t latency_us = ~0UL;
|
||||
|
||||
/*
|
||||
* We retry reading out timestamp plus remote time until the result
|
||||
@ -41,8 +41,8 @@ void Timer::Connection::_update_real_time()
|
||||
remote_time_trials < MAX_REMOTE_TIME_TRIALS; )
|
||||
{
|
||||
/* read out the two time values close in succession */
|
||||
Timestamp volatile new_ts = _timestamp();
|
||||
unsigned long volatile new_us = elapsed_us();
|
||||
Timestamp volatile new_ts = _timestamp();
|
||||
uint64_t volatile new_us = elapsed_us();
|
||||
|
||||
/* do not proceed until the time difference is at least 1 us */
|
||||
if (new_us == _us || new_ts == _ts) { continue; }
|
||||
@ -58,8 +58,8 @@ void Timer::Connection::_update_real_time()
|
||||
break;
|
||||
}
|
||||
/* determine latency between reading out timestamp and time value */
|
||||
Timestamp const ts_diff = _timestamp() - new_ts;
|
||||
unsigned long const new_latency_us =
|
||||
Timestamp const ts_diff = _timestamp() - new_ts;
|
||||
uint64_t const new_latency_us =
|
||||
_ts_to_us_ratio(ts_diff, _us_to_ts_factor, _us_to_ts_factor_shift);
|
||||
|
||||
/* remember results if the latency was better than on the last trial */
|
||||
@ -75,8 +75,8 @@ void Timer::Connection::_update_real_time()
|
||||
}
|
||||
|
||||
/* determine timestamp and time difference */
|
||||
unsigned long const us_diff = us - _us;
|
||||
Timestamp ts_diff = ts - _ts;
|
||||
uint64_t const us_diff = us - _us;
|
||||
Timestamp ts_diff = ts - _ts;
|
||||
|
||||
/* overwrite timestamp, time, and real time member */
|
||||
_us = us;
|
||||
@ -88,16 +88,16 @@ void Timer::Connection::_update_real_time()
|
||||
* Update timestamp-to-time factor and its shift
|
||||
*/
|
||||
|
||||
unsigned factor_shift = _us_to_ts_factor_shift;
|
||||
unsigned long old_factor = _us_to_ts_factor;
|
||||
Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift;
|
||||
Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1;
|
||||
unsigned factor_shift = _us_to_ts_factor_shift;
|
||||
uint64_t old_factor = _us_to_ts_factor;
|
||||
Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift;
|
||||
Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1;
|
||||
|
||||
/*
|
||||
* If the calculation type is bigger than the resulting factor type,
|
||||
* we have to apply further limitations to avoid a loss at the final cast.
|
||||
*/
|
||||
if (sizeof(Timestamp) > sizeof(unsigned long)) {
|
||||
if (sizeof(Timestamp) > sizeof(uint64_t)) {
|
||||
|
||||
Timestamp limit_ts_diff_shifted = (Timestamp)~0UL * us_diff;
|
||||
Timestamp const limit_ts_diff = limit_ts_diff_shifted >>
|
||||
@ -146,12 +146,12 @@ void Timer::Connection::_update_real_time()
|
||||
old_factor <<= 1;
|
||||
}
|
||||
/*
|
||||
* The cast to unsigned long does not cause a loss because of the
|
||||
* limitations we applied to the timestamp difference. We also took
|
||||
* care that the time difference cannot become null.
|
||||
* The cast to uint64_t does not cause a loss because the timestamp
|
||||
* type cannot be bigger as the factor type. We also took care that
|
||||
* the time difference cannot become null.
|
||||
*/
|
||||
unsigned long const new_factor =
|
||||
(unsigned long)((Timestamp)ts_diff_shifted / us_diff);
|
||||
uint64_t const new_factor =
|
||||
(uint64_t)((Timestamp)ts_diff_shifted / us_diff);
|
||||
|
||||
/* update interpolation-quality value */
|
||||
if (old_factor > new_factor) { _update_interpolation_quality(new_factor, old_factor); }
|
||||
@ -187,15 +187,15 @@ Duration Timer::Connection::curr_time()
|
||||
if (_interpolation_quality == MAX_INTERPOLATION_QUALITY)
|
||||
{
|
||||
/* buffer interpolation related members and free the lock */
|
||||
Timestamp const ts = _ts;
|
||||
unsigned long const us_to_ts_factor = _us_to_ts_factor;
|
||||
unsigned const us_to_ts_factor_shift = _us_to_ts_factor_shift;
|
||||
Timestamp const ts = _ts;
|
||||
uint64_t const us_to_ts_factor = _us_to_ts_factor;
|
||||
unsigned const us_to_ts_factor_shift = _us_to_ts_factor_shift;
|
||||
|
||||
lock_guard.destruct();
|
||||
|
||||
/* interpolate time difference since the last real time update */
|
||||
Timestamp const ts_diff = _timestamp() - ts;
|
||||
unsigned long const us_diff = _ts_to_us_ratio(ts_diff, us_to_ts_factor,
|
||||
Timestamp const ts_diff = _timestamp() - ts;
|
||||
uint64_t const us_diff = _ts_to_us_ratio(ts_diff, us_to_ts_factor,
|
||||
us_to_ts_factor_shift);
|
||||
|
||||
interpolated_time.add(Microseconds(us_diff));
|
||||
|
@ -99,10 +99,10 @@ struct Stress_test
|
||||
|
||||
Signal_handler<Slave> timer_handler;
|
||||
Timer::Connection timer;
|
||||
unsigned long us;
|
||||
uint64_t us;
|
||||
unsigned count { 0 };
|
||||
|
||||
Slave(Env &env, unsigned us)
|
||||
Slave(Env &env, uint64_t us)
|
||||
: timer_handler(env.ep(), *this, &Slave::handle_timer),
|
||||
timer(env), us(us) { timer.sigh(timer_handler); }
|
||||
|
||||
@ -119,7 +119,7 @@ struct Stress_test
|
||||
log("timer (period ", us, " us) triggered ", count,
|
||||
" times (min ", (unsigned)MIN_CNT,
|
||||
" max ", (unsigned)MAX_CNT, ") -> slept ",
|
||||
((unsigned long)us * count) / 1000, " ms");
|
||||
((uint64_t)us * count) / 1000, " ms");
|
||||
|
||||
/* detect starvation of timeouts */
|
||||
if (count < MIN_CNT) {
|
||||
@ -151,8 +151,8 @@ struct Stress_test
|
||||
{
|
||||
if (count < DURATION_SEC) {
|
||||
count++;
|
||||
log("wait ", count, "/", (unsigned)DURATION_SEC);
|
||||
timer.trigger_once(1000UL * 1000);
|
||||
log("wait ", count, "/", (uint64_t)DURATION_SEC);
|
||||
timer.trigger_once((uint64_t)1000 * 1000);
|
||||
} else {
|
||||
unsigned starvation = 0;
|
||||
unsigned rate_violation = 0;
|
||||
@ -175,13 +175,13 @@ struct Stress_test
|
||||
{
|
||||
timer.sigh(handler);
|
||||
|
||||
for (unsigned long us_1 = 1; us_1 < MAX_SLV_PERIOD_US; us_1 *= 2) {
|
||||
for (uint64_t us_1 = 1; us_1 < MAX_SLV_PERIOD_US; us_1 *= 2) {
|
||||
new (heap) Registered<Slave>(slaves, env, us_1 - us_1 / 3);
|
||||
new (heap) Registered<Slave>(slaves, env, us_1);
|
||||
}
|
||||
|
||||
slaves.for_each([&] (Slave &slv) { slv.start(); });
|
||||
timer.trigger_once(1000 * 1000);
|
||||
timer.trigger_once((uint64_t)1000 * 1000);
|
||||
}
|
||||
|
||||
~Stress_test() {
|
||||
|
@ -23,7 +23,7 @@ struct Main
|
||||
{
|
||||
Timer::Connection timer;
|
||||
Signal_handler<Main> timer_handler;
|
||||
unsigned duration_us { 0 };
|
||||
uint64_t duration_us { 0 };
|
||||
|
||||
void handle_timer()
|
||||
{
|
||||
|
@ -41,16 +41,17 @@ namespace Fiasco {
|
||||
using namespace Fiasco;
|
||||
using Microseconds = Genode::Microseconds;
|
||||
using Duration = Genode::Duration;
|
||||
using Genode::uint64_t;
|
||||
|
||||
|
||||
static l4_timeout_s mus_to_timeout(unsigned long mus)
|
||||
static l4_timeout_s mus_to_timeout(uint64_t mus)
|
||||
{
|
||||
if (mus == 0)
|
||||
return L4_IPC_TIMEOUT_0;
|
||||
else if (mus == ~0UL)
|
||||
else if (mus == ~(uint64_t)0)
|
||||
return L4_IPC_TIMEOUT_NEVER;
|
||||
|
||||
long e = Genode::log2(mus) - 7;
|
||||
long e = Genode::log2((unsigned long)mus) - 7;
|
||||
unsigned long m;
|
||||
if (e < 0) e = 0;
|
||||
m = mus / (1UL << e);
|
||||
@ -89,5 +90,5 @@ Duration Timer::Time_source::curr_time()
|
||||
}
|
||||
|
||||
|
||||
void Timer::Time_source::_usleep(unsigned long usecs) {
|
||||
void Timer::Time_source::_usleep(uint64_t usecs) {
|
||||
l4_ipc_sleep(l4_timeout(L4_IPC_TIMEOUT_NEVER, mus_to_timeout(usecs))); }
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
using Microseconds = Genode::Microseconds;
|
||||
using Duration = Genode::Duration;
|
||||
class Session_component;
|
||||
@ -43,7 +44,7 @@ class Timer::Session_component : public Genode::Rpc_object<Session>,
|
||||
Genode::Timeout_scheduler &_timeout_scheduler;
|
||||
Genode::Signal_context_capability _sigh { };
|
||||
|
||||
unsigned long const _init_time_us =
|
||||
uint64_t const _init_time_us =
|
||||
_timeout_scheduler.curr_time().trunc_to_plain_us().value;
|
||||
|
||||
void handle_timeout(Duration) override {
|
||||
@ -59,7 +60,7 @@ class Timer::Session_component : public Genode::Rpc_object<Session>,
|
||||
** Timer::Session **
|
||||
********************/
|
||||
|
||||
void trigger_once(unsigned us) override {
|
||||
void trigger_once(uint64_t us) override {
|
||||
|
||||
/*
|
||||
* FIXME Workaround for the problem that Alarm scheduler may
|
||||
@ -70,11 +71,11 @@ class Timer::Session_component : public Genode::Rpc_object<Session>,
|
||||
* Alarm framework takes solely relative time values, please
|
||||
* remove this.
|
||||
*/
|
||||
Microseconds typed_us((us > ~0U >> 1) ? ~0U >> 1 : us);
|
||||
Microseconds typed_us((us > ~(uint64_t)0 >> 1) ? ~(uint64_t)0 >> 1 : us);
|
||||
_timeout.schedule_one_shot(typed_us, *this);
|
||||
}
|
||||
|
||||
void trigger_periodic(unsigned us) override {
|
||||
void trigger_periodic(uint64_t us) override {
|
||||
_timeout.schedule_periodic(Microseconds(us), *this); }
|
||||
|
||||
void sigh(Signal_context_capability sigh) override
|
||||
@ -84,15 +85,15 @@ class Timer::Session_component : public Genode::Rpc_object<Session>,
|
||||
_timeout.discard();
|
||||
}
|
||||
|
||||
unsigned long elapsed_ms() const override {
|
||||
uint64_t elapsed_ms() const override {
|
||||
return elapsed_us() / 1000; }
|
||||
|
||||
unsigned long elapsed_us() const override {
|
||||
uint64_t elapsed_us() const override {
|
||||
return _timeout_scheduler.curr_time().trunc_to_plain_us().value -
|
||||
_init_time_us; }
|
||||
|
||||
void msleep(unsigned) override { /* never called at the server side */ }
|
||||
void usleep(unsigned) override { /* never called at the server side */ }
|
||||
void msleep(uint64_t) override { /* never called at the server side */ }
|
||||
void usleep(uint64_t) override { /* never called at the server side */ }
|
||||
};
|
||||
|
||||
#endif /* _SESSION_COMPONENT_ */
|
||||
|
@ -29,8 +29,8 @@ void Timer::Time_source::schedule_timeout(Microseconds duration,
|
||||
|
||||
void Timer::Time_source::_wait_for_irq()
|
||||
{
|
||||
enum { SLEEP_GRANULARITY_US = 1000UL };
|
||||
unsigned long last_time_us = curr_time().trunc_to_plain_us().value;
|
||||
enum { SLEEP_GRANULARITY_US = 1000 };
|
||||
uint64_t last_time_us = curr_time().trunc_to_plain_us().value;
|
||||
_lock.lock();
|
||||
while (_next_timeout_us > 0) {
|
||||
_lock.unlock();
|
||||
@ -38,8 +38,8 @@ void Timer::Time_source::_wait_for_irq()
|
||||
try { _usleep(SLEEP_GRANULARITY_US); }
|
||||
catch (Blocking_canceled) { }
|
||||
|
||||
unsigned long curr_time_us = curr_time().trunc_to_plain_us().value;
|
||||
unsigned long sleep_duration_us = curr_time_us - last_time_us;
|
||||
uint64_t curr_time_us = curr_time().trunc_to_plain_us().value;
|
||||
uint64_t sleep_duration_us = curr_time_us - last_time_us;
|
||||
last_time_us = curr_time_us;
|
||||
|
||||
_lock.lock();
|
||||
|
@ -18,7 +18,11 @@
|
||||
/* local includes */
|
||||
#include <threaded_time_source.h>
|
||||
|
||||
namespace Timer { class Time_source; }
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
class Time_source;
|
||||
}
|
||||
|
||||
|
||||
class Timer::Time_source : public Threaded_time_source
|
||||
@ -28,10 +32,10 @@ class Timer::Time_source : public Threaded_time_source
|
||||
Genode::Env &_env;
|
||||
|
||||
Genode::Lock mutable _lock { };
|
||||
unsigned long _curr_time_us = 0;
|
||||
unsigned long _next_timeout_us = max_timeout().value;
|
||||
uint64_t _curr_time_us = 0;
|
||||
uint64_t _next_timeout_us = max_timeout().value;
|
||||
|
||||
void _usleep(unsigned long us);
|
||||
void _usleep(uint64_t us);
|
||||
|
||||
|
||||
/**************************
|
||||
|
@ -53,7 +53,7 @@ void Timer::Time_source::schedule_timeout(Microseconds duration,
|
||||
Timeout_handler &handler)
|
||||
{
|
||||
_handler = &handler;
|
||||
unsigned long duration_us = duration.value;
|
||||
uint64_t duration_us = duration.value;
|
||||
|
||||
/* timeout '0' is trigger to cancel the current pending, if required */
|
||||
if (!duration.value) {
|
||||
@ -62,8 +62,8 @@ void Timer::Time_source::schedule_timeout(Microseconds duration,
|
||||
} else {
|
||||
/* limit timer-interrupt rate */
|
||||
enum { MAX_TIMER_IRQS_PER_SECOND = 4*1000 };
|
||||
if (duration_us < 1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND)
|
||||
duration_us = 1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND;
|
||||
if (duration_us < (uint64_t)1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND)
|
||||
duration_us = (uint64_t)1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND;
|
||||
|
||||
if (duration_us > max_timeout().value)
|
||||
duration_us = max_timeout().value;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
using Microseconds = Genode::Microseconds;
|
||||
using Duration = Genode::Duration;
|
||||
class Time_source;
|
||||
@ -70,7 +71,7 @@ class Timer::Time_source : public Genode::Signalled_time_source
|
||||
|
||||
Genode::Io_port_connection _io_port;
|
||||
Genode::Irq_connection _timer_irq;
|
||||
unsigned long mutable _curr_time_us = 0;
|
||||
uint64_t mutable _curr_time_us = 0;
|
||||
Genode::uint16_t mutable _counter_init_value = 0;
|
||||
bool mutable _handled_wrap = false;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <bsd_emul.h>
|
||||
|
||||
|
||||
static unsigned long millisecs;
|
||||
static Genode::uint64_t millisecs;
|
||||
|
||||
|
||||
namespace Bsd {
|
||||
@ -71,7 +71,7 @@ class Bsd::Timer
|
||||
millisecs = _timer_conn.elapsed_ms();
|
||||
}
|
||||
|
||||
void delay(unsigned ms)
|
||||
void delay(Genode::uint64_t ms)
|
||||
{
|
||||
_timer_conn.msleep(ms);
|
||||
}
|
||||
@ -88,7 +88,7 @@ void Bsd::timer_init(Genode::Env &env)
|
||||
_bsd_timer = &bsd_timer;
|
||||
|
||||
/* initialize value explicitly */
|
||||
millisecs = 0UL;
|
||||
millisecs = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ class Framebuffer::Driver
|
||||
Timer::Connection _timer;
|
||||
Genode::Reporter _reporter;
|
||||
Genode::Signal_handler<Driver> _poll_handler;
|
||||
unsigned long _poll_ms = 0;
|
||||
Genode::uint64_t _poll_ms = 0;
|
||||
|
||||
Genode::Signal_context_capability _config_sigh;
|
||||
|
||||
@ -74,7 +74,7 @@ class Framebuffer::Driver
|
||||
unsigned pitch() const { return _config._lx.pitch; }
|
||||
|
||||
void finish_initialization();
|
||||
void set_polling(unsigned long poll);
|
||||
void set_polling(Genode::uint64_t poll);
|
||||
void update_mode();
|
||||
void generate_report();
|
||||
|
||||
@ -117,8 +117,8 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
Genode::Attached_ram_dataspace _ds;
|
||||
bool _in_mode_change = true;
|
||||
|
||||
unsigned long _polling_from_config() {
|
||||
return _config.xml().attribute_value<unsigned long>("poll", 0); }
|
||||
Genode::uint64_t _polling_from_config() {
|
||||
return _config.xml().attribute_value<Genode::uint64_t>("poll", 0); }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -170,7 +170,7 @@ void Framebuffer::Driver::_poll()
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::Driver::set_polling(unsigned long poll)
|
||||
void Framebuffer::Driver::set_polling(Genode::uint64_t poll)
|
||||
{
|
||||
if (poll == _poll_ms) return;
|
||||
|
||||
|
@ -368,8 +368,8 @@ struct Wifi::Frontend
|
||||
bool _deferred_config_update { false };
|
||||
bool _single_autoconnect { false };
|
||||
|
||||
unsigned _connected_scan_interval { 30 };
|
||||
unsigned _scan_interval { 5 };
|
||||
Genode::uint64_t _connected_scan_interval { 30 };
|
||||
Genode::uint64_t _scan_interval { 5 };
|
||||
|
||||
void _config_update(bool signal)
|
||||
{
|
||||
@ -385,12 +385,12 @@ struct Wifi::Frontend
|
||||
/* only evaluated at start-up */
|
||||
_use_11n = config.attribute_value("use_11n", _use_11n);
|
||||
|
||||
unsigned connected_scan_interval =
|
||||
Genode::uint64_t connected_scan_interval =
|
||||
Util::check_time(config.attribute_value("connected_scan_interval",
|
||||
_connected_scan_interval),
|
||||
0, 15*60);
|
||||
|
||||
unsigned scan_interval =
|
||||
Genode::uint64_t scan_interval =
|
||||
Util::check_time(config.attribute_value("scan_interval",
|
||||
_scan_interval),
|
||||
5, 15*60);
|
||||
@ -699,7 +699,7 @@ struct Wifi::Frontend
|
||||
|
||||
bool _arm_scan_timer(bool connected)
|
||||
{
|
||||
unsigned const sec = connected ? _connected_scan_interval : _scan_interval;
|
||||
Genode::uint64_t const sec = connected ? _connected_scan_interval : _scan_interval;
|
||||
if (!sec) { return false; }
|
||||
|
||||
if (_verbose) {
|
||||
|
@ -78,7 +78,7 @@ namespace Util {
|
||||
return 2 * (level + 100);
|
||||
}
|
||||
|
||||
inline unsigned check_time(unsigned value, unsigned min, unsigned max)
|
||||
inline Genode::uint64_t check_time(Genode::uint64_t value, Genode::uint64_t min, Genode::uint64_t max)
|
||||
{
|
||||
if (value < min) { return min; }
|
||||
else if (value > max) { return max; }
|
||||
|
@ -19,6 +19,8 @@
|
||||
** linux/jiffies.h **
|
||||
*********************/
|
||||
|
||||
#include <base/fixed_stdint.h>
|
||||
|
||||
#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1)
|
||||
|
||||
extern unsigned long jiffies;
|
||||
@ -29,11 +31,11 @@ enum {
|
||||
JIFFIES_TICK_NS = 1000ULL*1000*1000/HZ,
|
||||
};
|
||||
|
||||
static inline unsigned long msecs_to_jiffies(const unsigned int m) { return m / JIFFIES_TICK_MS; }
|
||||
static inline unsigned long usecs_to_jiffies(const unsigned int u) { return u / JIFFIES_TICK_US; }
|
||||
static inline unsigned long msecs_to_jiffies(const genode_uint64_t m) { return m / JIFFIES_TICK_MS; }
|
||||
static inline unsigned long usecs_to_jiffies(const genode_uint64_t u) { return u / JIFFIES_TICK_US; }
|
||||
|
||||
static inline unsigned int jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; }
|
||||
static inline u64 jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; }
|
||||
static inline genode_uint64_t jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; }
|
||||
static inline genode_uint64_t jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; }
|
||||
|
||||
clock_t jiffies_to_clock_t(unsigned long x);
|
||||
static inline clock_t jiffies_delta_to_clock_t(long delta)
|
||||
|
@ -86,7 +86,7 @@ class Lx::Timer
|
||||
/**
|
||||
* Suspend calling thread
|
||||
*/
|
||||
virtual void usleep(unsigned us) = 0;
|
||||
virtual void usleep(Genode::uint64_t us) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -127,8 +127,8 @@ class Lx::Timer
|
||||
return;
|
||||
|
||||
/* calculate relative microseconds for trigger */
|
||||
unsigned long us = ctx->timeout > jiffies ?
|
||||
jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
|
||||
Genode::uint64_t us = ctx->timeout > jiffies ?
|
||||
(Genode::uint64_t)jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
|
||||
_timers_one_shot.schedule(Genode::Microseconds{us});
|
||||
}
|
||||
|
||||
|
@ -69,12 +69,12 @@ class Lx_kit::Scheduler : public Lx::Scheduler
|
||||
|
||||
struct Logger : Genode::Thread
|
||||
{
|
||||
Timer::Connection _timer;
|
||||
Lx::Scheduler &_scheduler;
|
||||
unsigned const _interval;
|
||||
Timer::Connection _timer;
|
||||
Lx::Scheduler &_scheduler;
|
||||
Genode::uint64_t const _interval;
|
||||
|
||||
Logger(Genode::Env &env, Lx::Scheduler &scheduler,
|
||||
unsigned interval_seconds)
|
||||
Genode::uint64_t interval_seconds)
|
||||
:
|
||||
Genode::Thread(env, "logger", 0x4000),
|
||||
_timer(env), _scheduler(scheduler),
|
||||
|
@ -114,8 +114,8 @@ class Lx_kit::Timer : public Lx::Timer
|
||||
return;
|
||||
|
||||
/* calculate relative microseconds for trigger */
|
||||
unsigned long us = ctx->timeout > _jiffies ?
|
||||
jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0;
|
||||
Genode::uint64_t us = ctx->timeout > _jiffies ?
|
||||
(Genode::uint64_t)jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0;
|
||||
_timer_conn.trigger_once(us);
|
||||
}
|
||||
|
||||
@ -290,10 +290,10 @@ class Lx_kit::Timer : public Lx::Timer
|
||||
* Do not use lx_emul usecs_to_jiffies(unsigned int) because
|
||||
* of implicit truncation!
|
||||
*/
|
||||
_jiffies = _timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS;
|
||||
_jiffies = (Genode::uint64_t)_timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS;
|
||||
}
|
||||
|
||||
void usleep(unsigned us) {
|
||||
void usleep(Genode::uint64_t us) {
|
||||
_timer_conn.usleep(us); }
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct Framebuffer_controller
|
||||
timer_handler(env.ep(), *this, &Framebuffer_controller::handle_timer)
|
||||
{
|
||||
Attached_rom_dataspace config(env, "config");
|
||||
unsigned long const period_ms = config.xml().attribute_value("artifical_update_ms", 0UL);
|
||||
Genode::uint64_t const period_ms = config.xml().attribute_value("artifical_update_ms", (Genode::uint64_t)0);
|
||||
|
||||
rom.sigh(rom_sigh);
|
||||
|
||||
|
@ -171,7 +171,7 @@ class Timed_semaphore : public Semaphore
|
||||
|
||||
protected:
|
||||
|
||||
bool on_alarm(unsigned) override
|
||||
bool on_alarm(Genode::uint64_t) override
|
||||
{
|
||||
_triggered = _sem._abort(_element);
|
||||
return false;
|
||||
|
@ -311,7 +311,7 @@ void rumpuser_free(void *mem, size_t len)
|
||||
int rumpuser_clock_gettime(int enum_rumpclock, int64_t *sec, long *nsec)
|
||||
{
|
||||
Hard_context *h = myself();
|
||||
unsigned long t = h->timer().elapsed_ms();
|
||||
Genode::uint64_t t = h->timer().elapsed_ms();
|
||||
*sec = (int64_t)t / 1000;
|
||||
*nsec = (t % 1000) * 1000;
|
||||
return 0;
|
||||
@ -321,18 +321,18 @@ int rumpuser_clock_gettime(int enum_rumpclock, int64_t *sec, long *nsec)
|
||||
int rumpuser_clock_sleep(int enum_rumpclock, int64_t sec, long nsec)
|
||||
{
|
||||
int nlocks;
|
||||
unsigned int msec = 0;
|
||||
Genode::uint64_t msec = 0;
|
||||
|
||||
Timer::Connection &timer = myself()->timer();
|
||||
|
||||
rumpkern_unsched(&nlocks, 0);
|
||||
switch (enum_rumpclock) {
|
||||
case RUMPUSER_CLOCK_RELWALL:
|
||||
msec = sec * 1000 + nsec / (1000*1000UL);
|
||||
msec = (Genode::uint64_t)sec * 1000 + nsec / (1000*1000UL);
|
||||
break;
|
||||
case RUMPUSER_CLOCK_ABSMONO:
|
||||
msec = timer.elapsed_ms();
|
||||
msec = ((sec * 1000) + (nsec / (1000 * 1000))) - msec;
|
||||
msec = (((Genode::uint64_t)sec * 1000) + ((Genode::uint64_t)nsec / (1000 * 1000))) - msec;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include "file_system.h"
|
||||
|
||||
#include <rump/env.h>
|
||||
#include <rump_fs/fs.h>
|
||||
@ -20,6 +19,8 @@
|
||||
#include <base/log.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
#include "file_system.h"
|
||||
|
||||
/**
|
||||
* We define our own fs arg structure to fit all sizes used by the different
|
||||
* file system implementations, we assume that 'fspec' * is the only valid
|
||||
|
@ -13,9 +13,9 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <timer_session/connection.h>
|
||||
#include <file_system_session/rpc_object.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/session_policy.h>
|
||||
#include <root/component.h>
|
||||
#include <base/component.h>
|
||||
@ -30,6 +30,7 @@
|
||||
#include "directory.h"
|
||||
#include "open_node.h"
|
||||
|
||||
|
||||
namespace Rump_fs {
|
||||
|
||||
using File_system::Packet_descriptor;
|
||||
|
@ -63,7 +63,7 @@ class Scout::Platform
|
||||
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
unsigned long _ticks = 0;
|
||||
Genode::uint64_t _ticks = 0;
|
||||
|
||||
void _handle_timer()
|
||||
{
|
||||
@ -128,7 +128,7 @@ class Scout::Platform
|
||||
/**
|
||||
* Get timer ticks in miilliseconds
|
||||
*/
|
||||
unsigned long timer_ticks() const { return _ticks; }
|
||||
Genode::uint64_t timer_ticks() const { return _ticks; }
|
||||
|
||||
/**
|
||||
* Register event handler
|
||||
|
@ -130,7 +130,7 @@ struct Main : Scout::Event_handler
|
||||
|
||||
bool const _launchpad_initialized = (_init_launchpad(), true);
|
||||
|
||||
unsigned long _old_time = _platform.timer_ticks();
|
||||
Genode::uint64_t _old_time = _platform.timer_ticks();
|
||||
|
||||
void handle_event(Scout::Event const &event) override
|
||||
{
|
||||
@ -147,7 +147,7 @@ struct Main : Scout::Event_handler
|
||||
Tick::handle(_platform.timer_ticks());
|
||||
|
||||
/* perform periodic redraw */
|
||||
unsigned long const curr_time = _platform.timer_ticks();
|
||||
Genode::uint64_t const curr_time = _platform.timer_ticks();
|
||||
if (!_platform.event_pending() && ((curr_time - _old_time > 20)
|
||||
|| (curr_time < _old_time))) {
|
||||
_old_time = curr_time;
|
||||
|
@ -121,7 +121,7 @@ struct Scout::Main : Scout::Event_handler
|
||||
|
||||
Scout::Point _mouse_position { };
|
||||
|
||||
unsigned long _old_time = _platform.timer_ticks();
|
||||
Genode::uint64_t _old_time = _platform.timer_ticks();
|
||||
|
||||
void handle_event(Scout::Event const &event) override
|
||||
{
|
||||
@ -156,7 +156,7 @@ struct Scout::Main : Scout::Event_handler
|
||||
Tick::handle(_platform.timer_ticks());
|
||||
|
||||
/* perform periodic redraw */
|
||||
unsigned long curr_time = _platform.timer_ticks();
|
||||
Genode::uint64_t curr_time = _platform.timer_ticks();
|
||||
if (!_platform.event_pending() && ((curr_time - _old_time > 20)
|
||||
|| (curr_time < _old_time))) {
|
||||
_old_time = curr_time;
|
||||
|
@ -199,8 +199,8 @@ class Liquid_fb::Main : public Scout::Event_handler
|
||||
|
||||
bool _services_initialized = (init_services(_env, _input_session_component), true);
|
||||
|
||||
unsigned long _curr_time = _platform.timer_ticks();
|
||||
unsigned long _old_time = _curr_time;
|
||||
Genode::uint64_t _curr_time = _platform.timer_ticks();
|
||||
Genode::uint64_t _old_time = _curr_time;
|
||||
|
||||
void _handle_config()
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ class Nano3d::Scene
|
||||
|
||||
public:
|
||||
|
||||
Scene(Genode::Env &env, unsigned update_rate_ms,
|
||||
Scene(Genode::Env &env, Genode::uint64_t update_rate_ms,
|
||||
Nitpicker::Point pos, Nitpicker::Area size)
|
||||
:
|
||||
_env(env), _pos(pos), _size(size)
|
||||
@ -302,7 +302,7 @@ class Nano3d::Scene
|
||||
|
||||
virtual ~Scene() { }
|
||||
|
||||
unsigned long elapsed_ms() const { return _timer.elapsed_ms(); }
|
||||
Genode::uint64_t elapsed_ms() const { return _timer.elapsed_ms(); }
|
||||
|
||||
void input_handler(Input_handler *input_handler)
|
||||
{
|
||||
|
@ -317,7 +317,7 @@ class Cpu_load_display::Scene : public Nano3d::Scene<PT>
|
||||
|
||||
public:
|
||||
|
||||
Scene(Genode::Env &env, unsigned update_rate_ms,
|
||||
Scene(Genode::Env &env, Genode::uint64_t update_rate_ms,
|
||||
Nitpicker::Point pos, Nitpicker::Area size)
|
||||
:
|
||||
Nano3d::Scene<PT>(env, update_rate_ms, pos, size),
|
||||
|
@ -17,10 +17,10 @@
|
||||
|
||||
using namespace Depot_deploy;
|
||||
|
||||
static void forward_to_log(unsigned long const sec,
|
||||
unsigned long const ms,
|
||||
char const *const base,
|
||||
char const *const end)
|
||||
static void forward_to_log(Genode::uint64_t const sec,
|
||||
Genode::uint64_t const ms,
|
||||
char const *const base,
|
||||
char const *const end)
|
||||
{
|
||||
log(sec, ".", ms < 10 ? "00" : ms < 100 ? "0" : "", ms, " ",
|
||||
Cstring(base, end - base));
|
||||
@ -152,7 +152,7 @@ void Child::gen_start_node(Xml_generator &xml,
|
||||
if (_running) {
|
||||
return; }
|
||||
|
||||
unsigned long max_timeout_sec = 0;
|
||||
Genode::uint64_t max_timeout_sec = 0;
|
||||
try {
|
||||
Xml_node const events = _pkg_xml->xml().sub_node("runtime").sub_node("events");
|
||||
events.for_each_sub_node("timeout", [&] (Xml_node const &event) {
|
||||
@ -431,9 +431,9 @@ void Child::log_session_write(Log_event::Line const &log_line)
|
||||
};
|
||||
|
||||
/* calculate timestamp that prefixes*/
|
||||
unsigned long const time_us { _timer.curr_time().trunc_to_plain_us().value - init_time_us };
|
||||
unsigned long time_ms { time_us / 1000UL };
|
||||
unsigned long const time_sec { time_ms / 1000UL };
|
||||
Genode::uint64_t const time_us { _timer.curr_time().trunc_to_plain_us().value - init_time_us };
|
||||
Genode::uint64_t time_ms { time_us / 1000UL };
|
||||
Genode::uint64_t const time_sec { time_ms / 1000UL };
|
||||
time_ms = time_ms - time_sec * 1000UL;
|
||||
|
||||
char const *const log_base { log_line.string() };
|
||||
@ -765,8 +765,8 @@ void Child::gen_installation_entry(Xml_generator &xml) const
|
||||
}
|
||||
|
||||
|
||||
void Child::event_occured(Event const &event,
|
||||
unsigned long const time_us)
|
||||
void Child::event_occured(Event const &event,
|
||||
Genode::uint64_t const time_us)
|
||||
{
|
||||
if (_skip) {
|
||||
return; }
|
||||
@ -779,9 +779,9 @@ void Child::event_occured(Event const &event,
|
||||
}
|
||||
|
||||
|
||||
void Child::_finished(State state,
|
||||
Event const &event,
|
||||
unsigned long const time_us)
|
||||
void Child::_finished(State state,
|
||||
Event const &event,
|
||||
Genode::uint64_t const time_us)
|
||||
{
|
||||
if (_skip) {
|
||||
return; }
|
||||
@ -789,8 +789,8 @@ void Child::_finished(State state,
|
||||
_running = false;
|
||||
_state = state;
|
||||
|
||||
unsigned long time_ms { time_us / 1000UL };
|
||||
unsigned long const time_sec { time_ms / 1000UL };
|
||||
Genode::uint64_t time_ms { time_us / 1000UL };
|
||||
Genode::uint64_t const time_sec { time_ms / 1000UL };
|
||||
time_ms = time_ms - time_sec * 1000UL;
|
||||
|
||||
char name_padded[32];
|
||||
@ -855,7 +855,7 @@ Timeout_event::Timeout_event(Timer::Connection &timer,
|
||||
Event { event, Type::TIMEOUT },
|
||||
_child { child },
|
||||
_timer { timer },
|
||||
_sec { event.attribute_value("sec", 0UL) },
|
||||
_sec { event.attribute_value("sec", (Genode::uint64_t)0) },
|
||||
_timeout { timer, *this, &Timeout_event::_handle_timeout }
|
||||
{
|
||||
if (!_sec) {
|
||||
|
@ -119,7 +119,7 @@ class Depot_deploy::Timeout_event : public Event,
|
||||
|
||||
Child &_child;
|
||||
Timer::Connection &_timer;
|
||||
unsigned long const _sec;
|
||||
Genode::uint64_t const _sec;
|
||||
Timer::One_shot_timeout<Timeout_event> _timeout;
|
||||
|
||||
void _handle_timeout(Duration);
|
||||
@ -136,7 +136,7 @@ class Depot_deploy::Timeout_event : public Event,
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
unsigned long sec() const { return _sec; }
|
||||
Genode::uint64_t sec() const { return _sec; }
|
||||
};
|
||||
|
||||
|
||||
@ -206,15 +206,15 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
Xml_node from_node,
|
||||
Xml_node::Type const &sub_node_type);
|
||||
|
||||
void _finished(State state,
|
||||
Event const &event,
|
||||
unsigned long const time_us);
|
||||
void _finished(State state,
|
||||
Event const &event,
|
||||
Genode::uint64_t const time_us);
|
||||
|
||||
State_name _padded_state_name() const;
|
||||
|
||||
public:
|
||||
|
||||
unsigned long init_time_us { 0 };
|
||||
Genode::uint64_t init_time_us { 0 };
|
||||
|
||||
Child(Genode::Allocator &alloc,
|
||||
Genode::Xml_node start_node,
|
||||
@ -229,8 +229,8 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
|
||||
void conclusion(Result &result);
|
||||
|
||||
void event_occured(Event const &event,
|
||||
unsigned long const time_us);
|
||||
void event_occured(Event const &event,
|
||||
Genode::uint64_t const time_us);
|
||||
|
||||
void apply_config(Xml_node start_node);
|
||||
|
||||
|
@ -156,18 +156,18 @@ struct Depot_deploy::Main
|
||||
if (finished) {
|
||||
|
||||
Result result;
|
||||
unsigned long previous_time_sec { 0UL };
|
||||
Genode::uint64_t previous_time_sec { 0 };
|
||||
if (config.has_sub_node("previous-results")) {
|
||||
Xml_node const previous_results = config.sub_node("previous-results");
|
||||
previous_time_sec += previous_results.attribute_value("time_sec", 0UL);
|
||||
previous_time_sec += previous_results.attribute_value("time_sec", (Genode::uint64_t)0);
|
||||
result.succeeded += previous_results.attribute_value("succeeded", 0UL);
|
||||
result.failed += previous_results.attribute_value("failed", 0UL);
|
||||
result.skipped += previous_results.attribute_value("skipped", 0UL);
|
||||
}
|
||||
unsigned long const time_us { _timer.curr_time().trunc_to_plain_us().value };
|
||||
unsigned long time_ms { time_us / 1000UL };
|
||||
unsigned long const time_sec { time_ms / 1000UL };
|
||||
time_ms = time_ms - time_sec * 1000UL;
|
||||
Genode::uint64_t const time_us { _timer.curr_time().trunc_to_plain_us().value };
|
||||
Genode::uint64_t time_ms { time_us / 1000 };
|
||||
Genode::uint64_t const time_sec { time_ms / 1000 };
|
||||
time_ms = time_ms - time_sec * 1000;
|
||||
|
||||
_children.conclusion(result);
|
||||
int exit_code = result.failed ? -1 : 0;
|
||||
|
@ -249,7 +249,7 @@ struct Depot_download_manager::Main : Import::Download_progress
|
||||
Fetchurl_watchdog(Main &main) : _main(main)
|
||||
{
|
||||
_timer.sigh(_handler);
|
||||
_timer.trigger_periodic(PERIOD_SECONDS*1000*1000);
|
||||
_timer.trigger_periodic((Genode::uint64_t)PERIOD_SECONDS*1000*1000);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -403,7 +403,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator,
|
||||
* button for a while.
|
||||
*/
|
||||
enum { CONTEXT_DELAY = 500 };
|
||||
_timer.trigger_once(CONTEXT_DELAY*1000);
|
||||
_timer.trigger_once((Genode::uint64_t)CONTEXT_DELAY*1000);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -145,9 +145,9 @@ struct Menu_view::Main
|
||||
{
|
||||
enum { PERIOD = 10 };
|
||||
|
||||
unsigned curr_frame() const { return elapsed_ms() / PERIOD; }
|
||||
Genode::uint64_t curr_frame() const { return elapsed_ms() / PERIOD; }
|
||||
|
||||
void schedule() { trigger_once(Frame_timer::PERIOD*1000); }
|
||||
void schedule() { trigger_once((Genode::uint64_t)Frame_timer::PERIOD*1000); }
|
||||
|
||||
Frame_timer(Env &env) : Timer::Connection(env) { }
|
||||
|
||||
@ -167,7 +167,7 @@ struct Menu_view::Main
|
||||
/**
|
||||
* Frame of last call of 'handle_frame_timer'
|
||||
*/
|
||||
unsigned _last_frame = 0;
|
||||
Genode::uint64_t _last_frame = 0;
|
||||
|
||||
/**
|
||||
* Number of frames between two redraws
|
||||
@ -250,7 +250,7 @@ void Menu_view::Main::_handle_dialog_update()
|
||||
* processing immediately. This way, we avoid latencies when the dialog
|
||||
* model is updated sporadically.
|
||||
*/
|
||||
unsigned const curr_frame = _timer.curr_frame();
|
||||
Genode::uint64_t const curr_frame = _timer.curr_frame();
|
||||
if (curr_frame != _last_frame) {
|
||||
|
||||
if (curr_frame - _last_frame > 10)
|
||||
@ -310,15 +310,15 @@ void Menu_view::Main::_handle_frame_timer()
|
||||
{
|
||||
_frame_cnt++;
|
||||
|
||||
unsigned const curr_frame = _timer.curr_frame();
|
||||
Genode::uint64_t const curr_frame = _timer.curr_frame();
|
||||
|
||||
if (_animator.active()) {
|
||||
|
||||
unsigned const passed_frames = max(curr_frame - _last_frame, 4U);
|
||||
Genode::uint64_t const passed_frames = max(curr_frame - _last_frame, 4U);
|
||||
|
||||
if (passed_frames > 0) {
|
||||
|
||||
for (unsigned i = 0; i < passed_frames; i++)
|
||||
for (Genode::uint64_t i = 0; i < passed_frames; i++)
|
||||
_animator.animate();
|
||||
|
||||
_schedule_redraw = true;
|
||||
|
@ -103,7 +103,7 @@ class Scene : public Nano3d::Scene<PT>
|
||||
|
||||
public:
|
||||
|
||||
Scene(Genode::Env &env, unsigned update_rate_ms,
|
||||
Scene(Genode::Env &env, Genode::uint64_t update_rate_ms,
|
||||
Nitpicker::Point pos, Nitpicker::Area size)
|
||||
:
|
||||
Nano3d::Scene<PT>(env, update_rate_ms, pos, size),
|
||||
|
@ -50,7 +50,7 @@ struct Cpu_sampler::Main : Thread_list_change_handler
|
||||
|
||||
unsigned int sample_index;
|
||||
unsigned int max_sample_index;
|
||||
unsigned int timeout_us;
|
||||
Genode::uint64_t timeout_us;
|
||||
|
||||
|
||||
void handle_timeout()
|
||||
@ -87,11 +87,11 @@ struct Cpu_sampler::Main : Thread_list_change_handler
|
||||
|
||||
sample_index = 0;
|
||||
|
||||
unsigned int sample_interval_ms =
|
||||
config.xml().attribute_value<unsigned int>("sample_interval_ms", 1000);
|
||||
Genode::uint64_t sample_interval_ms =
|
||||
config.xml().attribute_value<Genode::uint64_t>("sample_interval_ms", 1000);
|
||||
|
||||
unsigned int sample_duration_s =
|
||||
config.xml().attribute_value<unsigned int>("sample_duration_s", 10);
|
||||
Genode::uint64_t sample_duration_s =
|
||||
config.xml().attribute_value<Genode::uint64_t>("sample_duration_s", 10);
|
||||
|
||||
max_sample_index = ((sample_duration_s * 1000) / sample_interval_ms) - 1;
|
||||
|
||||
|
@ -443,9 +443,9 @@ struct Nit_fader::Main
|
||||
|
||||
unsigned long alpha = 0;
|
||||
|
||||
unsigned long curr_frame() const { return timer.elapsed_ms() / PERIOD; }
|
||||
Genode::uint64_t curr_frame() const { return timer.elapsed_ms() / PERIOD; }
|
||||
|
||||
unsigned long last_frame = 0;
|
||||
Genode::uint64_t last_frame = 0;
|
||||
|
||||
void handle_config_update();
|
||||
|
||||
@ -463,7 +463,7 @@ struct Nit_fader::Main
|
||||
|
||||
void handle_timer()
|
||||
{
|
||||
unsigned long frame = curr_frame();
|
||||
Genode::uint64_t frame = curr_frame();
|
||||
if (nitpicker_session.animate(frame - last_frame))
|
||||
timer.trigger_once(PERIOD);
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct Terminal::Main : Character_consumer
|
||||
* update of the pixels. By delaying the update, multiple intermediate
|
||||
* changes result in only one rendering step.
|
||||
*/
|
||||
unsigned const _flush_delay = 5;
|
||||
Genode::uint64_t const _flush_delay = 5;
|
||||
|
||||
bool _flush_scheduled = false;
|
||||
|
||||
@ -111,7 +111,7 @@ struct Terminal::Main : Character_consumer
|
||||
void _schedule_flush()
|
||||
{
|
||||
if (!_flush_scheduled) {
|
||||
_timer.trigger_once(1000*_flush_delay);
|
||||
_timer.trigger_once((Genode::uint64_t)1000*_flush_delay);
|
||||
_flush_scheduled = true;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ struct Test::Main
|
||||
{
|
||||
Timer::Connection timer(_env);
|
||||
|
||||
unsigned long const start_us = timer.elapsed_us();
|
||||
Genode::uint64_t const start_us = timer.elapsed_us();
|
||||
|
||||
enum { ITERATIONS = 40 };
|
||||
for (int i = 0; i < ITERATIONS; i++)
|
||||
@ -168,7 +168,7 @@ struct Test::Main
|
||||
_font_4, Color(150 + i*73, 0, 200),
|
||||
"Glyphs obtained from VFS");
|
||||
|
||||
unsigned long const end_us = timer.elapsed_us();
|
||||
Genode::uint64_t const end_us = timer.elapsed_us();
|
||||
unsigned long num_glyphs = strlen(vfs_text_string)*ITERATIONS;
|
||||
|
||||
log("uncached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph");
|
||||
@ -181,7 +181,7 @@ struct Test::Main
|
||||
|
||||
Timer::Connection timer(_env);
|
||||
|
||||
unsigned long const start_us = timer.elapsed_us();
|
||||
Genode::uint64_t const start_us = timer.elapsed_us();
|
||||
|
||||
/* use less iterations for small cache sizes */
|
||||
int const iterations = (limit_kib < 100) ? 200 : 2000;
|
||||
@ -192,7 +192,7 @@ struct Test::Main
|
||||
cached_font, Color(30, limit_kib, 150 + i*73),
|
||||
"Glyphs obtained from VFS");
|
||||
|
||||
unsigned long const end_us = timer.elapsed_us();
|
||||
Genode::uint64_t const end_us = timer.elapsed_us();
|
||||
unsigned long num_glyphs = strlen(vfs_text_string)*iterations;
|
||||
|
||||
log("cached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph"
|
||||
|
@ -19,7 +19,7 @@
|
||||
extern "C" __attribute__((weak))
|
||||
int _nanosleep(const struct timespec *req, struct timespec *rem)
|
||||
{
|
||||
unsigned long sleep_ms = req->tv_sec*1000 + req->tv_nsec/1000000;
|
||||
Genode::uint64_t sleep_ms = (uint64_t)req->tv_sec*1000 + req->tv_nsec/1000000;
|
||||
|
||||
if (!sleep_ms) return 0;
|
||||
|
||||
|
@ -262,8 +262,8 @@ _select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
{
|
||||
timeval const *_tv;
|
||||
bool const valid { _tv != nullptr };
|
||||
unsigned long duration {
|
||||
valid ? (unsigned long)_tv->tv_sec*1000 + _tv->tv_usec/1000 : 0UL };
|
||||
Genode::uint64_t duration {
|
||||
valid ? (Genode::uint64_t)_tv->tv_sec*1000 + _tv->tv_usec/1000 : 0UL };
|
||||
|
||||
bool expired() const { return valid && duration == 0; };
|
||||
|
||||
|
@ -158,12 +158,12 @@ struct Libc::Timer
|
||||
return _timer.curr_time();
|
||||
}
|
||||
|
||||
static Microseconds microseconds(unsigned long timeout_ms)
|
||||
static Microseconds microseconds(Genode::uint64_t timeout_ms)
|
||||
{
|
||||
return Microseconds(1000*timeout_ms);
|
||||
}
|
||||
|
||||
static unsigned long max_timeout()
|
||||
static Genode::uint64_t max_timeout()
|
||||
{
|
||||
return ~0UL/1000;
|
||||
}
|
||||
@ -198,8 +198,8 @@ struct Libc::Timeout
|
||||
Timeout_handler &_handler;
|
||||
::Timer::One_shot_timeout<Timeout> _timeout;
|
||||
|
||||
bool _expired = true;
|
||||
unsigned long _absolute_timeout_ms = 0;
|
||||
bool _expired = true;
|
||||
Genode::uint64_t _absolute_timeout_ms = 0;
|
||||
|
||||
void _handle(Duration now)
|
||||
{
|
||||
@ -215,7 +215,7 @@ struct Libc::Timeout
|
||||
_timeout(_timer_accessor.timer()._timer, *this, &Timeout::_handle)
|
||||
{ }
|
||||
|
||||
void start(unsigned long timeout_ms)
|
||||
void start(Genode::uint64_t timeout_ms)
|
||||
{
|
||||
Milliseconds const now = _timer_accessor.timer().curr_time().trunc_to_plain_ms();
|
||||
|
||||
@ -225,7 +225,7 @@ struct Libc::Timeout
|
||||
_timeout.schedule(_timer_accessor.timer().microseconds(timeout_ms));
|
||||
}
|
||||
|
||||
unsigned long duration_left() const
|
||||
Genode::uint64_t duration_left() const
|
||||
{
|
||||
Milliseconds const now = _timer_accessor.timer().curr_time().trunc_to_plain_ms();
|
||||
|
||||
@ -253,7 +253,7 @@ struct Libc::Pthreads
|
||||
_timeout.construct(_timer_accessor, *this);
|
||||
}
|
||||
|
||||
Pthread(Timer_accessor &timer_accessor, unsigned long timeout_ms)
|
||||
Pthread(Timer_accessor &timer_accessor, Genode::uint64_t timeout_ms)
|
||||
: _timer_accessor(timer_accessor)
|
||||
{
|
||||
if (timeout_ms > 0) {
|
||||
@ -262,7 +262,7 @@ struct Libc::Pthreads
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long duration_left()
|
||||
Genode::uint64_t duration_left()
|
||||
{
|
||||
_construct_timeout_once();
|
||||
return _timeout->duration_left();
|
||||
@ -290,7 +290,7 @@ struct Libc::Pthreads
|
||||
p->lock.unlock();
|
||||
}
|
||||
|
||||
unsigned long suspend_myself(Suspend_functor & check, unsigned long timeout_ms)
|
||||
Genode::uint64_t suspend_myself(Suspend_functor & check, Genode::uint64_t timeout_ms)
|
||||
{
|
||||
Pthread myself { timer_accessor, timeout_ms };
|
||||
{
|
||||
@ -430,13 +430,13 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
||||
: _timer_accessor(timer_accessor), _kernel(kernel)
|
||||
{ }
|
||||
|
||||
void timeout(unsigned long timeout_ms)
|
||||
void timeout(Genode::uint64_t timeout_ms)
|
||||
{
|
||||
_construct_timeout_once();
|
||||
_timeout->start(timeout_ms);
|
||||
}
|
||||
|
||||
unsigned long duration_left()
|
||||
Genode::uint64_t duration_left()
|
||||
{
|
||||
_construct_timeout_once();
|
||||
return _timeout->duration_left();
|
||||
@ -513,8 +513,8 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
||||
_longjmp(_user_context, 1);
|
||||
}
|
||||
|
||||
unsigned long _suspend_main(Suspend_functor &check,
|
||||
unsigned long timeout_ms)
|
||||
Genode::uint64_t _suspend_main(Suspend_functor &check,
|
||||
Genode::uint64_t timeout_ms)
|
||||
{
|
||||
/* check that we're not running on libc kernel context */
|
||||
if (Thread::mystack().top == _kernel_stack) {
|
||||
@ -651,7 +651,7 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
||||
/**
|
||||
* Suspend this context (main or pthread)
|
||||
*/
|
||||
unsigned long suspend(Suspend_functor &check, unsigned long timeout_ms)
|
||||
Genode::uint64_t suspend(Suspend_functor &check, Genode::uint64_t timeout_ms)
|
||||
{
|
||||
if (timeout_ms > 0
|
||||
&& timeout_ms > _timer_accessor.timer().max_timeout()) {
|
||||
@ -841,7 +841,7 @@ static void resumed_callback() { kernel->entrypoint_resumed(); }
|
||||
void Libc::resume_all() { kernel->resume_all(); }
|
||||
|
||||
|
||||
unsigned long Libc::suspend(Suspend_functor &s, unsigned long timeout_ms)
|
||||
Genode::uint64_t Libc::suspend(Suspend_functor &s, Genode::uint64_t timeout_ms)
|
||||
{
|
||||
if (!kernel) {
|
||||
error("libc kernel not initialized, needed for suspend()");
|
||||
|
@ -47,7 +47,7 @@ namespace Libc {
|
||||
* resumed the user context execution.
|
||||
*/
|
||||
struct Suspend_functor { virtual bool suspend() = 0; };
|
||||
unsigned long suspend(Suspend_functor &, unsigned long timeout_ms = 0UL);
|
||||
Genode::uint64_t suspend(Suspend_functor &, Genode::uint64_t timeout_ms = 0);
|
||||
|
||||
void dispatch_pending_io_signals();
|
||||
|
||||
|
@ -39,9 +39,9 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts)
|
||||
case CLOCK_REALTIME:
|
||||
case CLOCK_SECOND: /* FreeBSD specific */
|
||||
{
|
||||
static bool initial_rtc_requested = false;
|
||||
static time_t initial_rtc = 0;
|
||||
static unsigned long t0_ms = 0;
|
||||
static bool initial_rtc_requested = false;
|
||||
static time_t initial_rtc = 0;
|
||||
static Genode::uint64_t t0_ms = 0;
|
||||
|
||||
/* try to read rtc once */
|
||||
if (!initial_rtc_requested) {
|
||||
@ -54,7 +54,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts)
|
||||
|
||||
if (!initial_rtc) return Libc::Errno(EINVAL);
|
||||
|
||||
unsigned long time = Libc::current_time().trunc_to_plain_ms().value - t0_ms;
|
||||
Genode::uint64_t time = Libc::current_time().trunc_to_plain_ms().value - t0_ms;
|
||||
|
||||
ts->tv_sec = initial_rtc + time/1000;
|
||||
ts->tv_nsec = (time % 1000) * (1000*1000);
|
||||
@ -65,7 +65,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts)
|
||||
case CLOCK_MONOTONIC:
|
||||
case CLOCK_UPTIME:
|
||||
{
|
||||
unsigned long us = Libc::current_time().trunc_to_plain_us().value;
|
||||
Genode::uint64_t us = Libc::current_time().trunc_to_plain_us().value;
|
||||
|
||||
ts->tv_sec = us / (1000*1000);
|
||||
ts->tv_nsec = (us % (1000*1000)) * 1000;
|
||||
|
@ -173,7 +173,7 @@ class Libc::Timed_semaphore : public Semaphore
|
||||
|
||||
protected:
|
||||
|
||||
bool on_alarm(unsigned) override
|
||||
bool on_alarm(uint64_t) override
|
||||
{
|
||||
_triggered = _sem._abort(_element);
|
||||
return false;
|
||||
|
@ -31,7 +31,7 @@ struct Test : Thread
|
||||
Timeout_entrypoint timeout_ep;
|
||||
unsigned id;
|
||||
Timer::Connection wakeup_timer;
|
||||
unsigned const wakeup_period;
|
||||
uint64_t const wakeup_period;
|
||||
Timed_semaphore sem { timeout_ep };
|
||||
bool stop_wakeup { false };
|
||||
Lock wakeup_stopped { Lock::LOCKED };
|
||||
|
@ -262,7 +262,7 @@ struct Test::Test_base : private Genode::Fifo<Test_base>::Element
|
||||
_verbose(node.attribute_value("verbose", false)),
|
||||
_io_buffer(_node.attribute_value("io_buffer",
|
||||
Number_of_bytes(4*1024*1024))),
|
||||
_progress_interval(_node.attribute_value("progress", 0ul)),
|
||||
_progress_interval(_node.attribute_value("progress", (uint64_t)0)),
|
||||
_copy(_node.attribute_value("copy", true)),
|
||||
_batch(_node.attribute_value("batch", 1u)),
|
||||
_finished_sig(finished_sig)
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
struct Cpu_burner
|
||||
{
|
||||
@ -40,13 +41,13 @@ struct Cpu_burner
|
||||
|
||||
void _handle_period()
|
||||
{
|
||||
unsigned long const start_ms = _timer.elapsed_ms();
|
||||
uint64_t const start_ms = _timer.elapsed_ms();
|
||||
|
||||
unsigned iterations = 0;
|
||||
for (;; iterations++) {
|
||||
|
||||
unsigned long const curr_ms = _timer.elapsed_ms();
|
||||
unsigned long passed_ms = curr_ms - start_ms;
|
||||
uint64_t const curr_ms = _timer.elapsed_ms();
|
||||
uint64_t passed_ms = curr_ms - start_ms;
|
||||
|
||||
if (passed_ms >= 10*_percent)
|
||||
break;
|
||||
|
@ -329,7 +329,7 @@ struct Dummy::Main
|
||||
if (!_timer.constructed())
|
||||
_timer.construct(_env);
|
||||
|
||||
_timer->msleep(node.attribute_value("ms", 100UL));
|
||||
_timer->msleep(node.attribute_value("ms", (uint64_t)100));
|
||||
}
|
||||
|
||||
if (node.type() == "sleep_forever")
|
||||
|
@ -175,7 +175,7 @@ struct Global_keys_handler::Main
|
||||
*/
|
||||
Constructible<Timer::Connection> _timer { };
|
||||
|
||||
unsigned long const _delay_ms;
|
||||
uint64_t const _delay_ms;
|
||||
|
||||
Signal_handler<Report> _timer_handler;
|
||||
|
||||
@ -189,7 +189,7 @@ struct Global_keys_handler::Main
|
||||
_element(reports, *this),
|
||||
_bool_states(bool_states),
|
||||
_reporter(env, _name.string()),
|
||||
_delay_ms(node.attribute_value("delay_ms", 0UL)),
|
||||
_delay_ms(node.attribute_value("delay_ms", (uint64_t)0)),
|
||||
_timer_handler(env.ep(), *this, &Report::_generate_report)
|
||||
{
|
||||
_reporter.enabled(true);
|
||||
|
@ -111,7 +111,7 @@ struct Monitor
|
||||
period_ms = config.xml().attribute_value("period_ms", 1000UL);
|
||||
} catch (...) { }
|
||||
|
||||
timer.trigger_periodic(1000UL * period_ms);
|
||||
timer.trigger_periodic((Genode::uint64_t)1000 * period_ms);
|
||||
}
|
||||
|
||||
void check()
|
||||
|
@ -92,13 +92,13 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2)
|
||||
{
|
||||
/* FIXME limit the time because of shortcomings in timeout framework */
|
||||
enum { MAX_TIMEOUT_SEC = 3600 };
|
||||
unsigned long timeout_sec = _lease_time_sec >> lease_time_div_log2;
|
||||
uint64_t timeout_sec = _lease_time_sec >> lease_time_div_log2;
|
||||
|
||||
if (timeout_sec > MAX_TIMEOUT_SEC) {
|
||||
timeout_sec = MAX_TIMEOUT_SEC;
|
||||
warning("Had to prune the state timeout of DHCP client");
|
||||
}
|
||||
return Microseconds(timeout_sec * 1000UL * 1000UL);
|
||||
return Microseconds(timeout_sec * 1000 * 1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,8 +68,8 @@ class Net::Dhcp_client
|
||||
State _state { State::INIT };
|
||||
Timer::One_shot_timeout<Dhcp_client> _timeout;
|
||||
unsigned long _lease_time_sec = 0;
|
||||
Genode::Microseconds const _discover_timeout { DISCOVER_TIMEOUT_SEC * 1000 * 1000 };
|
||||
Genode::Microseconds const _request_timeout { REQUEST_TIMEOUT_SEC * 1000 * 1000 };
|
||||
Genode::Microseconds const _discover_timeout { (Genode::uint64_t)DISCOVER_TIMEOUT_SEC * 1000 * 1000 };
|
||||
Genode::Microseconds const _request_timeout { (Genode::uint64_t)REQUEST_TIMEOUT_SEC * 1000 * 1000 };
|
||||
Nic &_nic;
|
||||
Dhcp_client_handler &_handler;
|
||||
|
||||
|
@ -31,11 +31,11 @@ using namespace Net;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec)
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
unsigned long sec = node.attribute_value(name, 0UL);
|
||||
uint64_t sec = node.attribute_value(name, (uint64_t)0);
|
||||
if (!sec) {
|
||||
sec = default_sec;
|
||||
}
|
||||
@ -63,7 +63,7 @@ class Main : public Nic_handler,
|
||||
Xml_node _config { _config_rom.xml() };
|
||||
Timer::Connection _timer { _env };
|
||||
Microseconds _send_time { 0 };
|
||||
Microseconds _period_us { read_sec_attr(_config, "period_sec", DEFAULT_PERIOD_SEC) };
|
||||
Microseconds _period_us { read_sec_attr(_config, "period_sec", (uint64_t)DEFAULT_PERIOD_SEC) };
|
||||
Constructible<Periodic_timeout> _period { };
|
||||
Heap _heap { &_env.ram(), &_env.rm() };
|
||||
bool const _verbose { _config.attribute_value("verbose", false) };
|
||||
@ -271,13 +271,13 @@ void Main::_handle_icmp_echo_reply(Ipv4_packet &ip,
|
||||
chr = chr < 'z' ? chr + 1 : 'a';
|
||||
}
|
||||
/* calculate time since the request was sent */
|
||||
unsigned long time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value;
|
||||
unsigned long const time_ms = time_us / 1000UL;
|
||||
uint64_t time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value;
|
||||
uint64_t const time_ms = time_us / 1000UL;
|
||||
time_us = time_us - time_ms * 1000UL;
|
||||
|
||||
/* print success message */
|
||||
log(ICMP_DATA_SIZE + sizeof(Icmp_packet), " bytes from ", ip.src(),
|
||||
": icmp_seq=", icmp_seq, " ttl=", (unsigned long)IPV4_TIME_TO_LIVE,
|
||||
": icmp_seq=", icmp_seq, " ttl=", (uint64_t)IPV4_TIME_TO_LIVE,
|
||||
" time=", time_ms, ".", time_us ," ms");
|
||||
|
||||
/* raise ICMP sequence number and check exit condition */
|
||||
@ -405,12 +405,12 @@ void Main::_handle_udp(Ipv4_packet &ip,
|
||||
return;
|
||||
}
|
||||
/* calculate time since the request was sent */
|
||||
unsigned long time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value;
|
||||
unsigned long const time_ms = time_us / 1000UL;
|
||||
uint64_t time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value;
|
||||
uint64_t const time_ms = time_us / 1000UL;
|
||||
time_us = time_us - time_ms * 1000UL;
|
||||
|
||||
/* print success message */
|
||||
log(udp.length(), " bytes from ", ip.src(), " ttl=", (unsigned long)IPV4_TIME_TO_LIVE,
|
||||
log(udp.length(), " bytes from ", ip.src(), " ttl=", (uint64_t)IPV4_TIME_TO_LIVE,
|
||||
" time=", time_ms, ".", time_us ," ms");
|
||||
|
||||
/* check exit condition */
|
||||
|
@ -17,11 +17,11 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec)
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
unsigned long sec = node.attribute_value(name, 0UL);
|
||||
uint64_t sec = node.attribute_value(name, (uint64_t)0);
|
||||
if (!sec) {
|
||||
sec = default_sec;
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec);
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec);
|
||||
}
|
||||
|
||||
#endif /* _XML_NODE_H_ */
|
||||
|
@ -311,9 +311,9 @@ struct App::Main
|
||||
Reconstructible<Trace::Connection> _trace { _env, TRACE_RAM_QUOTA,
|
||||
ARG_BUFFER_RAM, PARENT_LEVELS };
|
||||
|
||||
static unsigned long _default_period_ms() { return 5000; }
|
||||
static uint64_t _default_period_ms() { return 5000; }
|
||||
|
||||
unsigned long _period_ms = _default_period_ms();
|
||||
uint64_t _period_ms = _default_period_ms();
|
||||
|
||||
SORT_TIME _sort { EC_TIME };
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec)
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
unsigned long sec = node.attribute_value(name, 0UL);
|
||||
uint64_t sec = node.attribute_value(name, (uint64_t)0);
|
||||
if (!sec) {
|
||||
sec = default_sec;
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec);
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec);
|
||||
}
|
||||
|
||||
#endif /* _XML_NODE_H_ */
|
||||
|
@ -164,9 +164,9 @@ struct App::Main
|
||||
|
||||
Reporter _reporter { _env, "trace_subjects", "trace_subjects", 64*1024 };
|
||||
|
||||
static unsigned long _default_period_ms() { return 5000; }
|
||||
static uint64_t _default_period_ms() { return 5000; }
|
||||
|
||||
unsigned long _period_ms = _default_period_ms();
|
||||
uint64_t _period_ms = _default_period_ms();
|
||||
|
||||
bool _report_affinity = false;
|
||||
bool _report_activity = false;
|
||||
|
@ -37,7 +37,7 @@ struct Ahci
|
||||
Timer_delayer(Genode::Env &env)
|
||||
: Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
} _delayer { env };
|
||||
|
||||
Ahci_root &root;
|
||||
|
@ -188,7 +188,7 @@ class Audio_out::Out
|
||||
{
|
||||
_timer.sigh(_timer_dispatcher);
|
||||
|
||||
unsigned const us = (Audio_out::PERIOD * 1000 / Audio_out::SAMPLE_RATE)*1000;
|
||||
uint64_t const us = (Audio_out::PERIOD * 1000 / Audio_out::SAMPLE_RATE)*1000;
|
||||
_timer.trigger_periodic(us);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class Timer_delayer : public Mmio::Delayer, public Timer::Connection
|
||||
|
||||
Timer_delayer(Genode::Env &env) : Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ class Framebuffer::Driver
|
||||
/**
|
||||
* Implementation of 'Delayer' interface
|
||||
*/
|
||||
void usleep(unsigned us)
|
||||
void usleep(uint64_t us)
|
||||
{
|
||||
Timer::Connection::usleep(us);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class Gpio::Reg : Attached_io_mem_dataspace, Mmio
|
||||
/**
|
||||
* Implementation of 'Delayer' interface
|
||||
*/
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
|
||||
} _delayer;
|
||||
|
||||
|
@ -95,7 +95,7 @@ struct Igd::Device
|
||||
Timer::Connection &_timer;
|
||||
Timer_delayer(Timer::Connection &timer) : _timer(timer) { }
|
||||
|
||||
void usleep(unsigned us) override { _timer.usleep(us); }
|
||||
void usleep(uint64_t us) override { _timer.usleep(us); }
|
||||
|
||||
} _delayer { _timer };
|
||||
|
||||
|
@ -685,7 +685,7 @@ struct Nvme::Controller : public Genode::Attached_mmio
|
||||
{
|
||||
enum { MAX = 50u, TO_UNIT = 500u, };
|
||||
Attempts const a(MAX);
|
||||
Microseconds const t((read<Cap::To>() * TO_UNIT) * (1000 / MAX));
|
||||
Microseconds const t(((uint64_t)read<Cap::To>() * TO_UNIT) * (1000 / MAX));
|
||||
try {
|
||||
wait_for(a, t, _delayer, Csts::Rdy::Equal(val));
|
||||
} catch (Mmio::Polling_timeout) {
|
||||
@ -1376,7 +1376,7 @@ class Driver : public Block::Driver
|
||||
Timer_delayer(Genode::Env &env)
|
||||
: Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
|
||||
} _delayer { _env };
|
||||
|
||||
|
@ -62,7 +62,7 @@ class Mbox : Genode::Attached_mmio
|
||||
struct Delayer : Mmio::Delayer
|
||||
{
|
||||
Timer::Connection timer;
|
||||
void usleep(unsigned us) override { timer.usleep(us); }
|
||||
void usleep(Genode::uint64_t us) override { timer.usleep(us); }
|
||||
|
||||
Delayer(Genode::Env &env) : timer(env) { }
|
||||
} _delayer { _env };
|
||||
|
@ -168,7 +168,7 @@ class Sd_card::Driver : public Driver_base,
|
||||
{
|
||||
Timer_delayer(Genode::Env &env) : Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
struct Block_transfer
|
||||
|
@ -27,7 +27,7 @@ int Driver::_wait_for_card_ready_mbw()
|
||||
* freely chosen.
|
||||
*/
|
||||
unsigned attempts = 5;
|
||||
unsigned constexpr attempts_delay_us = 100000;
|
||||
uint64_t constexpr attempts_delay_us = 100000;
|
||||
while (1) {
|
||||
if (!attempts) {
|
||||
error("Reading card status after multiblock write failed");
|
||||
|
@ -202,7 +202,7 @@ class Sd_card::Driver : public Driver_base,
|
||||
{
|
||||
Timer_delayer(Genode::Env &env) : Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
struct Block_transfer
|
||||
|
@ -162,7 +162,7 @@ class Sd_card::Driver : public Driver_base,
|
||||
{
|
||||
Timer_delayer(Genode::Env &env) : Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
Env &_env;
|
||||
|
@ -152,7 +152,7 @@ class Sd_card::Driver : public Driver_base,
|
||||
{
|
||||
Timer_delayer(Genode::Env &env) : Timer::Connection(env) { }
|
||||
|
||||
void usleep(unsigned us) override { Timer::Connection::usleep(us); }
|
||||
void usleep(uint64_t us) override { Timer::Connection::usleep(us); }
|
||||
};
|
||||
|
||||
Env &_env;
|
||||
|
@ -34,7 +34,7 @@ class Init::Heartbeat : Genode::Noncopyable
|
||||
|
||||
Constructible<Timer::Connection> _timer { };
|
||||
|
||||
unsigned _rate_ms = 0;
|
||||
uint64_t _rate_ms = 0;
|
||||
|
||||
Signal_handler<Heartbeat> _timer_handler;
|
||||
|
||||
|
@ -45,10 +45,10 @@ class Init::State_reporter : public Report_update_trigger
|
||||
|
||||
Reconstructible<Report_detail> _report_detail { };
|
||||
|
||||
unsigned _report_delay_ms = 0;
|
||||
uint64_t _report_delay_ms = 0;
|
||||
|
||||
/* interval used when child-ram reporting is enabled */
|
||||
unsigned _report_period_ms = 0;
|
||||
uint64_t _report_period_ms = 0;
|
||||
|
||||
/* version string from config, to be reflected in the report */
|
||||
typedef String<64> Version;
|
||||
@ -158,7 +158,7 @@ class Init::State_reporter : public Report_update_trigger
|
||||
* the user intends to limit the rate of state reports. If so, we
|
||||
* use the value of 'delay_ms' as interval.
|
||||
*/
|
||||
unsigned const period_ms = max(1000U, _report_delay_ms);
|
||||
uint64_t const period_ms = max(1000U, _report_delay_ms);
|
||||
bool const period_changed = (_report_period_ms != period_ms);
|
||||
bool const report_periodically = _report_detail->child_ram()
|
||||
|| _report_detail->child_caps();
|
||||
|
@ -120,8 +120,8 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
if (curr_step.has_type("sleep")
|
||||
&& curr_step.has_attribute("milliseconds")) {
|
||||
|
||||
unsigned long const milliseconds =
|
||||
curr_step.attribute_value("milliseconds", 0UL);
|
||||
Genode::uint64_t const milliseconds =
|
||||
curr_step.attribute_value("milliseconds", (Genode::uint64_t)0);
|
||||
|
||||
_timer.trigger_once(milliseconds*1000);
|
||||
_log("sleep ", milliseconds, " milliseconds");
|
||||
|
@ -404,8 +404,8 @@ class Input_filter::Chargen_source : public Source, Source::Sink
|
||||
Xml_node node)
|
||||
:
|
||||
_destination(destination), _timer(timer),
|
||||
_delay(node.attribute_value("delay_ms", 0UL)*1000),
|
||||
_rate (node.attribute_value("rate_ms", 0UL)*1000)
|
||||
_delay(node.attribute_value("delay_ms", (uint64_t)0)*1000),
|
||||
_rate (node.attribute_value("rate_ms", (uint64_t)0)*1000)
|
||||
{ }
|
||||
|
||||
void schedule_repeat(Codepoint character)
|
||||
|
@ -33,8 +33,8 @@ void Net::Interface::_handle_eth(void *const eth_base,
|
||||
|
||||
if (_log_time) {
|
||||
Genode::Duration const new_time = _timer.curr_time();
|
||||
unsigned long const new_time_ms = new_time.trunc_to_plain_us().value / 1000;
|
||||
unsigned long const old_time_ms = _curr_time.trunc_to_plain_us().value / 1000;
|
||||
uint64_t const new_time_ms = new_time.trunc_to_plain_us().value / 1000;
|
||||
uint64_t const old_time_ms = _curr_time.trunc_to_plain_us().value / 1000;
|
||||
|
||||
log("\033[33m(", remote._label, " <- ", _label, ")\033[0m ",
|
||||
packet_log(eth, _log_cfg), " \033[33mtime ", new_time_ms,
|
||||
|
@ -30,7 +30,7 @@ class Main
|
||||
|
||||
Attached_rom_dataspace _config;
|
||||
Timer::Connection _timer;
|
||||
Duration _curr_time { Microseconds(0UL) };
|
||||
Duration _curr_time { Microseconds(0) };
|
||||
Heap _heap;
|
||||
Net::Root _root;
|
||||
|
||||
|
@ -89,7 +89,7 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2)
|
||||
{
|
||||
/* FIXME limit the time because of shortcomings in timeout framework */
|
||||
enum { MAX_TIMEOUT_SEC = 3600 };
|
||||
unsigned long timeout_sec = _lease_time_sec >> lease_time_div_log2;
|
||||
uint64_t timeout_sec = _lease_time_sec >> lease_time_div_log2;
|
||||
|
||||
if (timeout_sec > MAX_TIMEOUT_SEC) {
|
||||
timeout_sec = MAX_TIMEOUT_SEC;
|
||||
@ -102,7 +102,7 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2)
|
||||
log("[?] prune re-request timeout of DHCP client"); }
|
||||
}
|
||||
}
|
||||
return Microseconds(timeout_sec * 1000UL * 1000UL);
|
||||
return Microseconds(timeout_sec * 1000 * 1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Net::Dhcp_client
|
||||
Interface &_interface;
|
||||
State _state { State::INIT };
|
||||
Timer::One_shot_timeout<Dhcp_client> _timeout;
|
||||
unsigned long _lease_time_sec = 0;
|
||||
Genode::uint64_t _lease_time_sec = 0;
|
||||
|
||||
void _handle_dhcp_reply(Dhcp_packet &dhcp);
|
||||
|
||||
|
@ -63,13 +63,13 @@ Dhcp_server::Dhcp_server(Xml_node const node,
|
||||
|
||||
Microseconds Dhcp_server::_init_ip_lease_time(Xml_node const node)
|
||||
{
|
||||
unsigned long ip_lease_time_sec =
|
||||
node.attribute_value("ip_lease_time_sec", 0UL);
|
||||
uint64_t ip_lease_time_sec =
|
||||
node.attribute_value("ip_lease_time_sec", (uint64_t)0);
|
||||
|
||||
if (!ip_lease_time_sec) {
|
||||
ip_lease_time_sec = DEFAULT_IP_LEASE_TIME_SEC;
|
||||
}
|
||||
return Microseconds((unsigned long)ip_lease_time_sec * 1000 * 1000);
|
||||
return Microseconds((uint64_t)ip_lease_time_sec * 1000 * 1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
unsigned long const default_sec)
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
unsigned long sec = node.attribute_value(name, 0UL);
|
||||
uint64_t sec = node.attribute_value(name, (uint64_t)0);
|
||||
if (!sec) {
|
||||
sec = default_sec;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user