Deleted Added
sdiff udiff text old ( 11937:e6621fafa62d ) new ( 11990:5fad911cc326 )
full compact
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#ifndef SWIG // SWIG doesn't support strongly typed enums
50/**
51 * Object drain/handover states
52 *
53 * An object starts out in the Running state. When the simulator
54 * prepares to take a snapshot or prepares a CPU for handover, it
55 * calls the drain() method to transfer the object into the Draining
56 * or Drained state. If any object enters the Draining state
57 * (Drainable::drain() returning >0), simulation continues until it

--- 12 unchanged lines hidden (view full) ---

70 * actually a bit more elaborate. See Drainable::drain() for details.
71 */
72enum class DrainState {
73 Running, /** Running normally */
74 Draining, /** Draining buffers pending serialization/handover */
75 Drained, /** Buffers drained, ready for serialization/handover */
76 Resuming, /** Transient state while the simulator is resuming */
77};
78#endif
79
80/**
81 * This class coordinates draining of a System.
82 *
83 * When draining the simulator, we need to make sure that all
84 * Drainable objects within the system have ended up in the drained
85 * state before declaring the operation to be successful. This class
86 * keeps track of how many objects are still in the process of

--- 5 unchanged lines hidden (view full) ---

92 * to be restarted until all Drainable objects declare that they don't
93 * need further simulation to be completely drained. See Drainable for
94 * more information.
95 */
96class DrainManager
97{
98 private:
99 DrainManager();
100#ifndef SWIG
101 DrainManager(DrainManager &) = delete;
102#endif
103 ~DrainManager();
104
105 public:
106 /** Get the singleton DrainManager instance */
107 static DrainManager &instance() { return _instance; }
108
109 /**
110 * Try to drain the system.

--- 209 unchanged lines hidden ---