Spaces:
Running
Download README.md from pgg-engineering/kthwake: direct link, hf CLI and curl.
- Browser
- Download file 4.07 kB
-
https://huggingface.co/spaces/pgg-engineering/kthwake/resolve/main/README.md
- Command line
-
hf download hf://spaces/pgg-engineering/kthwake/README.md
-
curl -L -o README.md https://huggingface.co/spaces/pgg-engineering/kthwake/resolve/main/README.md
title: KthWake · Sliding-window threshold scheduler
emoji: ⏱️
license: apache-2.0
tags:
- cpp
- stream-processing
- time-series
- multi-agent
sdk: static
app_file: index.html
short_description: Turn rolling event counts into callbacks and idle deadlines
colorFrom: gray
colorTo: gray
thumbnail: >-
https://huggingface.co/spaces/pgg-engineering/kthwake/resolve/main/art/share.png
KthWake · Sliding-window threshold scheduler
Wake a waiting task when three tool results finish in 20 ms. KthWake sits between an ordered stream of completions and a scheduler. Feed it a timestamp and an arrival count. It returns the IDs and new states of rules that changed. The scheduler can set one timer for the next expiry, even when no more results arrive.
Open the timeline · C++ source kit · Single header · Checksums for these two files
Replay a deadline
The timeline starts with two completions at 0 ms and one at 5 ms. The third completion turns rule 0 on. Choose Next callback to watch it turn off at 20 ms, when the first two completions leave the window.
To try the second run, enter 0, 0, 5, 20, 20 under Completion times (ms) and choose Apply trace. Arrivals and expiries at the same timestamp count together. At 20 ms, the first pair expires and the new pair arrives. Three completions still qualify, so the rule stays on. The next callback turns it off at 25 ms.
The browser timeline runs in JavaScript. Both traces above also ran against the released C++17 implementation. The Python binding and JSONL CLI use the native index.
Install the Python binding
Build the binding with CPython, a C++17 compiler, wheel and setuptools.
python -m pip install --no-build-isolation 'git+https://github.com/pgg898200-ship-it/chronosieve.git@7cca93890a5bfa1e120f6aaabda8d1b8d7957b1f#subdirectory=companions/kthwake'
from kthwake import Index
ix = Index([(3, 20)])
assert ix.step(100, 2) == []
assert ix.step(105, 1) == [(0, True)]
assert ix.next_expiry() == 120
assert ix.step(120) == [(0, False)]
The release downloads include the source archive, header, CPython 3.12 Linux x86-64 wheel, native Linux x86-64 CLI and benchmark results. The file named SHA256SUMS lists the digest for each download.
Benchmarks and contributions
The runnable release includes recorded arrivals from Mooncake and an Azure code-serving holdout, with three modeled policy registries per trace. It also includes million-subscriber synthetic cases, a timestamp-aware correctness oracle and competing native implementations. Evaluations distinguish observation-time snapshots from every timer-driven crossing. On the Azure individual-rate workload, KthWake delivered 330,890 timestamped transitions in 37.1 ms. The fastest of three native heap alternatives took 75.0 ms. The heap won the other two Azure timer workloads.
Performance evidence · Source files · Independent benchmark instructions · Community