View | Details | Raw Unified | Return to bug 191
Collapse All | Expand All

(-)a/examples/mixed-wireless.cc (-1 / +1 lines)
 Lines 358-364   main (int argc, char *argv[]) Link Here 
358
  /////////////////////////////////////////////////////////////////////////// 
358
  /////////////////////////////////////////////////////////////////////////// 
359
359
360
  NS_LOG_INFO ("Run Simulation.");
360
  NS_LOG_INFO ("Run Simulation.");
361
  Simulator::StopAt (Seconds (stopTime));
361
  Simulator::Stop (Seconds (stopTime));
362
  Simulator::Run ();    
362
  Simulator::Run ();    
363
  Simulator::Destroy ();
363
  Simulator::Destroy ();
364
}
364
}
(-)a/examples/simple-point-to-point-olsr.cc (-1 / +1 lines)
 Lines 161-167   main (int argc, char *argv[]) Link Here 
161
  PointToPointHelper::EnablePcapAll ("simple-point-to-point-olsr");
161
  PointToPointHelper::EnablePcapAll ("simple-point-to-point-olsr");
162
  PointToPointHelper::EnableAsciiAll (ascii);
162
  PointToPointHelper::EnableAsciiAll (ascii);
163
163
164
  Simulator::StopAt (Seconds (30));
164
  Simulator::Stop (Seconds (30));
165
165
166
  NS_LOG_INFO ("Run Simulation.");
166
  NS_LOG_INFO ("Run Simulation.");
167
  Simulator::Run ();
167
  Simulator::Run ();
(-)a/examples/tcp-large-transfer.cc (-1 / +1 lines)
 Lines 191-197   int main (int argc, char *argv[]) Link Here 
191
191
192
  PointToPointHelper::EnablePcapAll ("tcp-large-transfer");
192
  PointToPointHelper::EnablePcapAll ("tcp-large-transfer");
193
193
194
  Simulator::StopAt (Seconds(1000));
194
  Simulator::Stop (Seconds(1000));
195
  Simulator::Run ();
195
  Simulator::Run ();
196
  Simulator::Destroy ();
196
  Simulator::Destroy ();
197
}
197
}
(-)a/examples/wifi-ap.cc (-1 / +1 lines)
 Lines 170-176   int main (int argc, char *argv[]) Link Here 
170
  apps.Start (Seconds (0.5));
170
  apps.Start (Seconds (0.5));
171
  apps.Stop (Seconds (43.0));
171
  apps.Stop (Seconds (43.0));
172
172
173
  Simulator::StopAt (Seconds (44.0));
173
  Simulator::Stop (Seconds (44.0));
174
174
175
  Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
175
  Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
176
  Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
176
  Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
(-)a/samples/main-random-topology.cc (-1 / +1 lines)
 Lines 35-41   int main (int argc, char *argv[]) Link Here 
35
  Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
35
  Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
36
                              MakeCallback (&CourseChange));
36
                              MakeCallback (&CourseChange));
37
  
37
  
38
  Simulator::StopAt (Seconds (100.0));
38
  Simulator::Stop (Seconds (100.0));
39
39
40
  Simulator::Run ();
40
  Simulator::Run ();
41
  
41
  
(-)a/samples/main-random-walk.cc (-1 / +1 lines)
 Lines 44-50   int main (int argc, char *argv[]) Link Here 
44
  Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
44
  Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
45
                   MakeCallback (&CourseChange));
45
                   MakeCallback (&CourseChange));
46
46
47
  Simulator::StopAt (Seconds (100.0));
47
  Simulator::Stop (Seconds (100.0));
48
48
49
  Simulator::Run ();
49
  Simulator::Run ();
50
  
50
  
(-)a/src/devices/wifi/wifi-test.cc (-1 / +1 lines)
 Lines 81-87   WifiTest::RunOne (void) Link Here 
81
  Simulator::Run ();
81
  Simulator::Run ();
82
  Simulator::Destroy ();
82
  Simulator::Destroy ();
83
83
84
  Simulator::StopAt (Seconds (10.0));
84
  Simulator::Stop (Seconds (10.0));
85
}
85
}
86
86
87
bool
87
bool
(-)a/src/node/application.cc (-5 / +3 lines)
 Lines 108-122   void Application::StopApplication() Link Here 
108
// Private helpers
108
// Private helpers
109
void Application::ScheduleStart (const Time &startTime)
109
void Application::ScheduleStart (const Time &startTime)
110
{
110
{
111
  m_startEvent = Simulator::Schedule(startTime -
111
  m_startEvent = Simulator::Schedule (startTime,
112
                                     Simulator::Now(),
112
                                      &Application::StartApplication, this);
113
                                     &Application::StartApplication, this);
114
}
113
}
115
114
116
void Application::ScheduleStop (const Time &stopTime)
115
void Application::ScheduleStop (const Time &stopTime)
117
{
116
{
118
  m_stopEvent = Simulator::Schedule(stopTime -
117
  m_stopEvent = Simulator::Schedule (stopTime,
119
                                    Simulator::Now(),
120
                                    &Application::StopApplication, this);
118
                                    &Application::StopApplication, this);
121
}
119
}
122
120
(-)a/src/node/application.h (-13 / +13 lines)
 Lines 53-65   class Application : public Object Link Here 
53
{
53
{
54
public:
54
public:
55
  static TypeId GetTypeId (void);
55
  static TypeId GetTypeId (void);
56
  Application();
56
  Application ();
57
  virtual ~Application();
57
  virtual ~Application ();
58
  
58
  
59
  /**
59
  /**
60
   * \brief Specify application start time
60
   * \brief Specify application start time
61
   * \param startTime Start time for this application, absolute time,
61
   * \param startTime Start time for this application,
62
   *        relative to the start of the simulation.
62
   *        relative to the current simulation time.
63
   *
63
   *
64
   * Applications start at various times in the simulation scenario.
64
   * Applications start at various times in the simulation scenario.
65
   * The Start method specifies when the application should be
65
   * The Start method specifies when the application should be
 Lines 67-86   public: Link Here 
67
   * private "StartApplication" method defined below, which is called at the
67
   * private "StartApplication" method defined below, which is called at the
68
   * time specified, to cause the application to begin.
68
   * time specified, to cause the application to begin.
69
   */
69
   */
70
  void Start(const Time& startTime);
70
  void Start (const Time& startTime);
71
71
72
  /** 
72
  /** 
73
   * \brief Specify application start time.
73
   * \brief Specify application start time.
74
   * \param startVariable the random variable to use to pick
74
   * \param startVariable the random variable to use to pick
75
   *        the real start time as an absolute time, in units of
75
   *        the real start time as a relative time, in units of
76
   *        seconds, relative to the start of the simulation.
76
   *        seconds, relative to the current simulation time.
77
   */
77
   */
78
  void Start(const RandomVariable& startVariable);
78
  void Start (const RandomVariable& startVariable);
79
  
79
  
80
  /**
80
  /**
81
   * \brief Specify application stop time
81
   * \brief Specify application stop time
82
   * \param stopTime Stop time for this application, relative to the
82
   * \param stopTime Stop time for this application, relative to the
83
   *        start of the simulation.
83
   *        current simulation time.
84
   *
84
   *
85
   * Once an application has started, it is sometimes useful
85
   * Once an application has started, it is sometimes useful
86
   * to stop the application.  The Stop method specifies when an
86
   * to stop the application.  The Stop method specifies when an
 Lines 88-107   public: Link Here 
88
   * the private StopApplication method, to be notified when that
88
   * the private StopApplication method, to be notified when that
89
   * time has come.
89
   * time has come.
90
   */
90
   */
91
  void Stop(const Time& stopTime);
91
  void Stop (const Time& stopTime);
92
92
93
  /**
93
  /**
94
   * \brief Specify application stop time
94
   * \brief Specify application stop time
95
   * \param stopVariable the random variable to use to pick
95
   * \param stopVariable the random variable to use to pick
96
   *        the real stop time, in units of seconds, 
96
   *        the real stop time, in units of seconds, 
97
   *        relative to the start of the simulation.
97
   *        relative to the current simulation time.
98
   */
98
   */
99
  void Stop(const RandomVariable& stopVariable);
99
  void Stop (const RandomVariable& stopVariable);
100
100
101
  /**
101
  /**
102
   * \returns the Node to which this Application object is attached.
102
   * \returns the Node to which this Application object is attached.
103
   */
103
   */
104
  Ptr<Node> GetNode() const;
104
  Ptr<Node> GetNode () const;
105
105
106
  /**
106
  /**
107
   * \param node the node to which this Application object is attached.
107
   * \param node the node to which this Application object is attached.
(-)a/src/simulator/simulator.cc (-7 / +8 lines)
 Lines 68-74   public: Link Here 
68
  bool IsFinished (void) const;
68
  bool IsFinished (void) const;
69
  Time Next (void) const;
69
  Time Next (void) const;
70
  void Stop (void);
70
  void Stop (void);
71
  void StopAt (Time const &time);
71
  void Stop (Time const &time);
72
  EventId Schedule (Time const &time, const Ptr<EventImpl> &event);
72
  EventId Schedule (Time const &time, const Ptr<EventImpl> &event);
73
  EventId ScheduleNow (const Ptr<EventImpl> &event);
73
  EventId ScheduleNow (const Ptr<EventImpl> &event);
74
  EventId ScheduleDestroy (const Ptr<EventImpl> &event);
74
  EventId ScheduleDestroy (const Ptr<EventImpl> &event);
 Lines 249-258   SimulatorPrivate::Stop (void) Link Here 
249
  m_stop = true;
249
  m_stop = true;
250
}
250
}
251
void 
251
void 
252
SimulatorPrivate::StopAt (Time const &at)
252
SimulatorPrivate::Stop (Time const &time)
253
{
253
{
254
  NS_ASSERT (at.IsPositive ());
254
  NS_ASSERT (time.IsPositive ());
255
  m_stopAt = at.GetTimeStep ();
255
  Time absolute = Simulator::Now () + time;
256
  m_stopAt = absolute.GetTimeStep ();
256
}
257
}
257
EventId
258
EventId
258
SimulatorPrivate::Schedule (Time const &time, const Ptr<EventImpl> &event)
259
SimulatorPrivate::Schedule (Time const &time, const Ptr<EventImpl> &event)
 Lines 485-493   Simulator::Stop (void) Link Here 
485
  GetPriv ()->Stop ();
486
  GetPriv ()->Stop ();
486
}
487
}
487
void 
488
void 
488
Simulator::StopAt (Time const &at)
489
Simulator::Stop (Time const &time)
489
{
490
{
490
  GetPriv ()->StopAt (at);
491
  GetPriv ()->Stop (time);
491
}
492
}
492
Time
493
Time
493
Simulator::Now (void)
494
Simulator::Now (void)
 Lines 1125-1131   SimulatorTests::RunTests (void) Link Here 
1125
  Simulator::Destroy ();
1126
  Simulator::Destroy ();
1126
1127
1127
  Simulator::Schedule (Seconds (10.0), &SimulatorTests::baz1, this, 0);
1128
  Simulator::Schedule (Seconds (10.0), &SimulatorTests::baz1, this, 0);
1128
  Simulator::StopAt (Seconds (1.0));
1129
  Simulator::Stop (Seconds (1.0));
1129
  Simulator::Run ();
1130
  Simulator::Run ();
1130
  Simulator::Destroy ();
1131
  Simulator::Destroy ();
1131
1132
(-)a/src/simulator/simulator.h (-5 / +6 lines)
 Lines 126-137   public: Link Here 
126
   */
126
   */
127
  static void Stop (void);
127
  static void Stop (void);
128
  /**
128
  /**
129
   * Force the Simulator::run method to return to the caller
129
   * Force the Simulator::run method to return to the caller when the
130
   * when the expiration time of the next event to be processed 
130
   * expiration time of the next event to be processed is greater than
131
   * is greater than or equal to the stop time.
131
   * or equal to the stop time.  The stop time is relative to the
132
   * @param time the stop time.
132
   * current simulation time.
133
   * @param time the stop time, relative to the current time.
133
   */
134
   */
134
  static void StopAt (Time const &time);
135
  static void Stop (Time const &time);
135
136
136
  /**
137
  /**
137
   * Schedule an event to expire when the time "now + time" 
138
   * Schedule an event to expire when the time "now + time" 

Return to bug 191