author | Craig Dowell <craigdo@ee.washington.edu> |
Tue, 26 Aug 2008 15:34:57 -0700 | |
changeset 3560 | 5aa65b1ea001 |
child 3561 | e388935fa948 |
permissions | -rw-r--r-- |
3560
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 University of Washington |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
*/ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
#ifndef REALTIME_SIMULATOR_IMPL_H |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
#define REALTIME_SIMULATOR_IMPL_H |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
#include "simulator-impl.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
24 |
#include "scheduler.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
#include "synchronizer.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
#include "event-impl.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
#include "ns3/ptr.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
#include "ns3/assert.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
#include "ns3/log.h" |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
#include <list> |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
#include <fstream> |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
namespace ns3 { |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
class RealtimeEventLock : public EventLock |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
{ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
public: |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
40 |
void Lock (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
void Unlock (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
private: |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
SystemMutex m_eventMutex; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
44 |
}; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
45 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
class RealtimeSimulatorImpl : public SimulatorImpl |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
47 |
{ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
48 |
public: |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
49 |
static TypeId GetTypeId (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
50 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
51 |
/** |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
52 |
* Enumeration of the types of packets supported in the class. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
53 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
54 |
*/ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
55 |
enum SynchronizationMode { |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
56 |
SYNC_BEST_EFFORT, /** Make a best effort to keep synced to real-time */ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
57 |
SYNC_HARD_LIMIT, /** Keep to real-time within a tolerance or die trying */ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
58 |
}; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
59 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
60 |
RealtimeSimulatorImpl (); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
61 |
~RealtimeSimulatorImpl (); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
62 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
63 |
void Destroy (); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
64 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
65 |
void EnableLogTo (char const *filename); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
66 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
67 |
bool IsFinished (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
Time Next (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
69 |
void Stop (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
void Stop (Time const &time); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
EventId Schedule (Time const &time, const Ptr<EventImpl> &event); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |
EventId ScheduleNow (const Ptr<EventImpl> &event); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
73 |
EventId ScheduleDestroy (const Ptr<EventImpl> &event); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
74 |
void Remove (const EventId &ev); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
75 |
void Cancel (const EventId &ev); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
76 |
bool IsExpired (const EventId &ev) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
77 |
virtual void RunOneEvent (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
78 |
void Run (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
79 |
Time Now (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
80 |
Time GetDelayLeft (const EventId &id) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
81 |
Time GetMaximumSimulationTime (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
82 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
83 |
void SetScheduler (Ptr<Scheduler> scheduler); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
84 |
Ptr<Scheduler> GetScheduler (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
85 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
86 |
void SetSynchronizationMode (RealtimeSimulatorImpl::SynchronizationMode mode); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
87 |
RealtimeSimulatorImpl::SynchronizationMode GetSynchronizationMode (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
88 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
89 |
void SetHardLimit (Time limit); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
90 |
Time GetHardLimit (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
91 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
92 |
private: |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
93 |
bool Running (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
94 |
bool Realtime (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
95 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
96 |
void ProcessOneEvent (void); |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
97 |
uint64_t NextTs (void) const; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
98 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
99 |
typedef std::list<EventId> DestroyEvents; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
100 |
DestroyEvents m_destroyEvents; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
101 |
uint64_t m_stopAt; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
102 |
bool m_stop; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
103 |
bool m_running; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
104 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
105 |
// The following variables are protected using the m_mutex |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
106 |
Ptr<Scheduler> m_events; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
107 |
int m_unscheduledEvents; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
108 |
uint32_t m_uid; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
109 |
uint32_t m_currentUid; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
110 |
uint64_t m_currentTs; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
111 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
112 |
mutable SystemMutex m_mutex; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
113 |
RealtimeEventLock m_eventLock; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
114 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
115 |
Ptr<Synchronizer> m_synchronizer; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
116 |
/* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
117 |
* In calls to Simulator::Now we have a basic choice to make. We can either |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
118 |
* report back the time the simulator thinks it should be, or we can report |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
119 |
* the time it actually is. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
120 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
121 |
* The synchronizer will make an attempt to cause these two numbers to be as |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
122 |
* close as possible to each other, but they will never be exactly the same. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
123 |
* We give the client a choice in this respect. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
124 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
125 |
* If the client sets m_reportSimulatedTime to true, the behavior will be that |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
126 |
* the simulator runs as close as possible to real time, but reports back to the |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
127 |
* client that it is running at exactly real time, and consuming no real time |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
128 |
* as each event executes. This allows for deterministic execution times and |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
129 |
* repeatable trace files. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
130 |
* |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
131 |
* If the client sets m_reportSimulatedTime to false, the behavior will be that |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
132 |
* the simulator runs as close as possible to real time, and reports back to the |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
133 |
* client the real wall-clock time whenever it asks. Real time will be consumed |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
134 |
* as each event executes. This allows for non-deterministic execution times and |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
135 |
* real variations in event executions. Simulation time will be influenced by |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
136 |
* variations in host process scheduling, for example. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
137 |
*/ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
138 |
bool m_reportSimulatedTime; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
139 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
140 |
/** |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
141 |
* The policy to use if the simulation cannot keep synchronized to real-time. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
142 |
*/ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
143 |
SynchronizationMode m_synchronizationMode; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
144 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
145 |
/** |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
146 |
* The maximum allowable drift from real-time in SYNC_HARD_LIMIT mode. |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
147 |
*/ |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
148 |
Time m_hardLimit; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
149 |
}; |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
150 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
151 |
} // namespace ns3 |
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
152 |
|
5aa65b1ea001
add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
153 |
#endif /* REALTIME_SIMULATOR_IMPL_H */ |