|
31 | 31 |
|
32 | 32 | namespace dispenso {
|
33 | 33 |
|
| 34 | +#if !defined(DISPENSO_WAKEUP_ENABLE) |
| 35 | +#if defined(_WIN32) || defined(__linux__) |
| 36 | +#define DISPENSO_WAKEUP_ENABLE 1 |
| 37 | +#else |
| 38 | +// TODO(bbudge): For now, only enable Linux and Windows. On Mac still need to figure out how to |
| 39 | +// wake more quickly (see e.g. |
| 40 | +// https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html) |
| 41 | +#define DISPENSO_WAKEUP_ENABLE 0 |
| 42 | +#endif // Linux or Windows |
| 43 | +#endif // DISPENSO_WAKEUP_ENABLE |
| 44 | + |
34 | 45 | #if !defined(DISPENSO_POLL_PERIOD_US)
|
35 | 46 | #if defined(_WIN32)
|
36 | 47 | #define DISPENSO_POLL_PERIOD_US 1000
|
37 | 48 | #else
|
38 |
| -#if !defined(DISPENSO_WAKEUP_ENABLE) |
| 49 | +#if !(DISPENSO_WAKEUP_ENABLE) |
39 | 50 | #define DISPENSO_POLL_PERIOD_US 200
|
40 | 51 | #else
|
41 |
| -#define DISPENSO_POLL_PERIOD_US 8000 |
| 52 | +#define DISPENSO_POLL_PERIOD_US (1 << 15) // Determined empirically good on dual Xeon Linux |
42 | 53 | #endif // DISPENSO_WAKEUP_ENABLE
|
43 | 54 | #endif // PLATFORM
|
44 | 55 | #endif // DISPENSO_POLL_PERIOD_US
|
45 | 56 |
|
46 | 57 | constexpr uint32_t kDefaultSleepLenUs = DISPENSO_POLL_PERIOD_US;
|
47 | 58 |
|
48 |
| -#if defined(DISPENSO_WAKEUP_ENABLE) |
49 | 59 | constexpr bool kDefaultWakeupEnable = DISPENSO_WAKEUP_ENABLE;
|
50 |
| -#else |
51 |
| -#if defined(__WIN32) |
52 |
| -constexpr bool kDefaultWakeupEnable = true; |
53 |
| -#else |
54 |
| -constexpr bool kDefaultWakeupEnable = false; |
55 |
| -#endif // PLATFORM |
56 |
| -#endif // DISPENSO_WAKEUP_ENABLE |
57 | 60 |
|
58 | 61 | /**
|
59 | 62 | * A simple tag specifier that can be fed to TaskSets and
|
|
0 commit comments