1/* 2 * Copyright (c) 2012, 2015, 2017 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 32 unchanged lines hidden (view full) --- 41#define __SIM_DRAIN_HH__ 42 43#include <atomic> 44#include <mutex> 45#include <vector> 46 47class Drainable; 48 |
49/** 50 * Object drain/handover states 51 * 52 * An object starts out in the Running state. When the simulator 53 * prepares to take a snapshot or prepares a CPU for handover, it 54 * calls the drain() method to transfer the object into the Draining 55 * or Drained state. If any object enters the Draining state 56 * (Drainable::drain() returning >0), simulation continues until it --- 12 unchanged lines hidden (view full) --- 69 * actually a bit more elaborate. See Drainable::drain() for details. 70 */ 71enum class DrainState { 72 Running, /** Running normally */ 73 Draining, /** Draining buffers pending serialization/handover */ 74 Drained, /** Buffers drained, ready for serialization/handover */ 75 Resuming, /** Transient state while the simulator is resuming */ 76}; |
77 78/** 79 * This class coordinates draining of a System. 80 * 81 * When draining the simulator, we need to make sure that all 82 * Drainable objects within the system have ended up in the drained 83 * state before declaring the operation to be successful. This class 84 * keeps track of how many objects are still in the process of --- 5 unchanged lines hidden (view full) --- 90 * to be restarted until all Drainable objects declare that they don't 91 * need further simulation to be completely drained. See Drainable for 92 * more information. 93 */ 94class DrainManager 95{ 96 private: 97 DrainManager(); |
98 DrainManager(DrainManager &) = delete; |
99 ~DrainManager(); 100 101 public: 102 /** Get the singleton DrainManager instance */ 103 static DrainManager &instance() { return _instance; } 104 105 /** 106 * Try to drain the system. --- 209 unchanged lines hidden --- |