diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 20:39:26 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 20:39:26 +0100 |
| commit | 8f520e52d7d4081a0835374c7a448116baac64ab (patch) | |
| tree | fdb3c2e8d49aa8c94d6fff357ef2d18f3e0e553c /ot_clean.h | |
| parent | 7419a9524754dfc4222de2c4e4c22808b571477d (diff) | |
Turn the bucket count into a knob, but keep cleaner wake-ups at a constant rate
Diffstat (limited to 'ot_clean.h')
| -rw-r--r-- | ot_clean.h | 13 |
1 files changed, 11 insertions, 2 deletions
| @@ -9,8 +9,17 @@ | |||
| 9 | /* The amount of time a clean cycle should take */ | 9 | /* The amount of time a clean cycle should take */ |
| 10 | #define OT_CLEAN_INTERVAL_MINUTES 2 | 10 | #define OT_CLEAN_INTERVAL_MINUTES 2 |
| 11 | 11 | ||
| 12 | /* So after each bucket wait 1 / OT_BUCKET_COUNT intervals */ | 12 | /* How often the cleaner may wake. A full sweep takes OT_CLEAN_INTERVAL_MINUTES. |
| 13 | #define OT_CLEAN_SLEEP (((OT_CLEAN_INTERVAL_MINUTES) * 60 * 1000000) / (OT_BUCKET_COUNT)) | 13 | The clean operations per wake is goverend by OT_BUCKET_COUNT_BITS, |
| 14 | set by the Makefile. | ||
| 15 | At the default of 1024 buckets this works out at one bucket every | ||
| 16 | 117 ms. */ | ||
| 17 | #define OT_CLEAN_MAX_WAKES_PER_SECOND 10 | ||
| 18 | |||
| 19 | #define OT_CLEAN_WAKE_BUDGET ((OT_CLEAN_INTERVAL_MINUTES) * 60 * (OT_CLEAN_MAX_WAKES_PER_SECOND)) | ||
| 20 | #define OT_CLEAN_BUCKETS_PER_WAKE (((OT_BUCKET_COUNT) + (OT_CLEAN_WAKE_BUDGET) - 1) / (OT_CLEAN_WAKE_BUDGET)) | ||
| 21 | #define OT_CLEAN_WAKES ((OT_BUCKET_COUNT) / (OT_CLEAN_BUCKETS_PER_WAKE)) | ||
| 22 | #define OT_CLEAN_SLEEP (((OT_CLEAN_INTERVAL_MINUTES) * 60 * 1000000) / (OT_CLEAN_WAKES)) | ||
| 14 | 23 | ||
| 15 | void clean_init(void); | 24 | void clean_init(void); |
| 16 | void clean_deinit(void); | 25 | void clean_deinit(void); |
