#ifndef AIMD_SCHEDULER_HPP
#define AIMD_SCHEDULER_HPP

#include "scheduler_iface.hpp"

class UtilizationMonitor;

// AIMD: K worker threads, but the cap on the number of CHUNK-sized
// chunks that may be in flight simultaneously is governed by an
// additive-increase / multiplicative-decrease rule driven by the
// EWMA load signal from UtilizationMonitor (which samples /proc/stat).
//
// If external_monitor is non-null, AIMD reads its EWMA value instead
// of creating and starting/stopping its own. Pass a pre-started
// monitor from main() to avoid charging the start/stop latency to
// the AIMD benchmark.
int run_aimd_scheduler(int F, int K, task_fn_t task, void* ctx, bool affinity,
                       UtilizationMonitor* external_monitor = nullptr);

#endif
