diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-07-09 23:48:06 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-07-09 23:48:06 +0200 |
| commit | c94d0c347fdbd8acc774df4ac17617a3f63e4507 (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /Simulator/src/Simulator.cpp | |
| parent | bc4c41e21a64b444bdbab3b6d1d407fd5d919419 (diff) | |
Delete old codebase
This change removes version 1 of the OpenDC simulator codebase as it
will be replaced by a complete rewrite in the Kotlin language.
Diffstat (limited to 'Simulator/src/Simulator.cpp')
| -rw-r--r-- | Simulator/src/Simulator.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Simulator/src/Simulator.cpp b/Simulator/src/Simulator.cpp deleted file mode 100644 index 62482f5c..00000000 --- a/Simulator/src/Simulator.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "Simulator.h" -#include "modeling/ModelingTypes.h" - -#include <iostream> -#include <chrono> -#include <thread> -#include <cassert> - -int main(int argc, char* argv[]) -{ - assert(argc == 2); - - // The main simulator, responsible for updating and writing away each simulation. - Simulation::Simulator simulator(argv[1]); - - // Timer used for polling only once every 5 seconds - auto pollTimer = std::chrono::high_resolution_clock::now() - std::chrono::seconds(5); - - while (true) - { - auto now = std::chrono::high_resolution_clock::now(); - - // Calculate the time since the last polling - std::chrono::duration<double> diff = now - pollTimer; - if (diff.count() > 5) // Every five seconds, poll and load - { - // Poll and load all experiments queued in the database - simulator.pollAndLoadAll(); - // Reset the timer for polling - pollTimer = std::chrono::high_resolution_clock::now(); - } - - if (simulator.hasSimulations()) - { - // Update each simulation - simulator.tickAll(); - // Save the state of each simulation - simulator.saveStateAll(); - // Write the history of each simulation when 500 states have been saved - simulator.writeHistoryAll(); - } - else // Wait for polling - { - std::chrono::duration<double> timeToSleep = std::chrono::seconds(5) - diff; - std::this_thread::sleep_for(diff); - } - } - - // Terminal pause, press key to exit - std::cin.get(); -} |
