|
Player12
An open source football management simulator
|
Simulates a batch of independent matches in parallel. More...
#include <match_scheduler.h>
Public Member Functions | |
| MatchScheduler (unsigned thread_count=ThreadPool::defaultThreadCount()) | |
| void | setThreadCount (unsigned thread_count) |
| unsigned | getThreadCount () const |
| std::vector< MatchSimulationResult > | run (const std::vector< MatchSimulationInput > &inputs, const StatsConfig &config) |
| void | resetProgress () |
| SimulationProgress | getProgress () const |
Private Attributes | |
| unsigned | threads = 1 |
| std::unique_ptr< ThreadPool > | pool |
| std::atomic< uint32_t > | completed {0} |
| std::atomic< uint32_t > | total {0} |
Simulates a batch of independent matches in parallel.
Results come back in input order and each match is fully determined by its input, so a batch gives identical results for any thread count.
|
explicit |
|
inline |
Safe to call from any thread while a batch runs.
|
inline |
|
inline |
Starts counting afresh (e.g. at the start of a day).
| std::vector< MatchSimulationResult > MatchScheduler::run | ( | const std::vector< MatchSimulationInput > & | inputs, |
| const StatsConfig & | config | ||
| ) |
Simulates every input; result i belongs to inputs[i].
| void MatchScheduler::setThreadCount | ( | unsigned | thread_count | ) |
Threads per batch including the caller; 1 simulates on the caller.
|
private |
|
private |
|
private |
|
private |