drain.hh (11937:e6621fafa62d) drain.hh (11990:5fad911cc326)
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
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};
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};
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();
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();
100#ifndef SWIG
101 DrainManager(DrainManager &) = delete;
98 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 ---
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 ---