|
Udipe 1.0
Solving the riddle of high-throughput UDP
|
Time-related definitions. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | UDIPE_DURATION_DEFAULT ((udipe_duration_ns_t)0) |
| #define | UDIPE_DURATION_MIN ((udipe_duration_ns_t)1) |
| #define | UDIPE_DURATION_MAX ((udipe_duration_ns_t)UINT64_MAX) |
| #define | UDIPE_MILLISECOND ((udipe_duration_ns_t)1000*1000) |
| #define | UDIPE_SECOND (1000*UDIPE_MILLISECOND) |
| #define | UDIPE_MINUTE (60*UDIPE_SECOND) |
| #define | UDIPE_HOUR (60*UDIPE_MINUTE) |
| #define | UDIPE_DAY (24*UDIPE_HOUR) |
Typedefs | |
| typedef uint64_t | udipe_duration_ns_t |
At the time of writing, the public libudipe API only exposes support for timeouts, but when a given worker thread awaits multiple timeouts, its implementation is closer in spirit to deadline scheduling. So if the need emerges, support for deadlines would not be hard to add to the public API.
| #define UDIPE_DAY (24*UDIPE_HOUR) |
One day
| #define UDIPE_DURATION_DEFAULT ((udipe_duration_ns_t)0) |
Default value of udipe_duration_ns_t
When used as a parameter, this function means that the default duration should be used. For timeouts, this is UDIPE_DURATION_MAX.
| #define UDIPE_DURATION_MAX ((udipe_duration_ns_t)UINT64_MAX) |
Maximal significant value of udipe_duration_ns_t
When used as a timeout, this value indicates a desire for unbounded blocking i.e. wait indefinitely until the event of interest happens or an error prevents it from happening.
| #define UDIPE_DURATION_MIN ((udipe_duration_ns_t)1) |
Minimal significant value of udipe_duration_ns_t
When used as a timeout, this value indicates a desire for non-blocking operation i.e. if something can be done immediately then it is done, otherwise the function should fail with a timeout error immediately.
| #define UDIPE_HOUR (60*UDIPE_MINUTE) |
One hour
| #define UDIPE_MILLISECOND ((udipe_duration_ns_t)1000*1000) |
One millisecond
This is the shortest sub-multiple of the second that can reliably be used as a timeout or other form of target duration in udipe. Durations on a microsecond time scale or shorter tend to overshoot by a large margin because many system calls take more than a microsecond to process.
| #define UDIPE_MINUTE (60*UDIPE_SECOND) |
One minute
| #define UDIPE_SECOND (1000*UDIPE_MILLISECOND) |
One second
| typedef uint64_t udipe_duration_ns_t |
Duration in nanoseconds (0, 1 and the maximum value are special)
This type, which is typically used for timeouts as an abstraction over the many different time formats used by operating system APIs, can encode durations up to a bit more than 584 years.
Because processing a network command takes an amount of time which is much greater than a nanosecond (it's closer to the microsecond scale), timeouts should be understood as a lower bound on the duration for which network operations will be awaited, rather than as an absolute deadline by which a given command should have completed.
The following values of udipe_duration_ns_t will be treated specially: