equal
deleted
inserted
replaced
175 } |
175 } |
176 void |
176 void |
177 SimulatorPrivate::StopAt (Time const &at) |
177 SimulatorPrivate::StopAt (Time const &at) |
178 { |
178 { |
179 assert (at.IsPositive ()); |
179 assert (at.IsPositive ()); |
180 m_stopAt = at.ApproximateToNanoSeconds (); |
180 m_stopAt = at.GetNanoSeconds (); |
181 } |
181 } |
182 EventId |
182 EventId |
183 SimulatorPrivate::Schedule (Time const &time, EventImpl *event) |
183 SimulatorPrivate::Schedule (Time const &time, EventImpl *event) |
184 { |
184 { |
185 assert (time.IsPositive ()); |
185 assert (time.IsPositive ()); |
186 assert (time >= NanoSeconds (m_currentNs)); |
186 assert (time >= NanoSeconds (m_currentNs)); |
187 uint64_t ns = (uint64_t) time.ApproximateToNanoSeconds (); |
187 uint64_t ns = (uint64_t) time.GetNanoSeconds (); |
188 Scheduler::EventKey key = {ns, m_uid}; |
188 Scheduler::EventKey key = {ns, m_uid}; |
189 if (m_logEnable) |
189 if (m_logEnable) |
190 { |
190 { |
191 m_log << "i "<<m_currentUid<<" "<<m_currentNs<<" " |
191 m_log << "i "<<m_currentUid<<" "<<m_currentNs<<" " |
192 <<m_uid<<" "<<time.ApproximateToNanoSeconds () << std::endl; |
192 <<m_uid<<" "<<time.GetSeconds () << std::endl; |
193 } |
193 } |
194 m_uid++; |
194 m_uid++; |
195 return m_events->Insert (event, key); |
195 return m_events->Insert (event, key); |
196 } |
196 } |
197 void |
197 void |
211 SimulatorPrivate::ScheduleDestroy (EventImpl *event) |
211 SimulatorPrivate::ScheduleDestroy (EventImpl *event) |
212 { |
212 { |
213 m_destroy.push_back (std::make_pair (event, m_uid)); |
213 m_destroy.push_back (std::make_pair (event, m_uid)); |
214 if (m_logEnable) |
214 if (m_logEnable) |
215 { |
215 { |
216 m_log << "id " << m_currentUid << " " << Now ().ApproximateToNanoSeconds () << " " |
216 m_log << "id " << m_currentUid << " " << Now ().GetNanoSeconds () << " " |
217 << m_uid << std::endl; |
217 << m_uid << std::endl; |
218 } |
218 } |
219 m_uid++; |
219 m_uid++; |
220 } |
220 } |
221 |
221 |
495 SimulatorTests::~SimulatorTests () |
495 SimulatorTests::~SimulatorTests () |
496 {} |
496 {} |
497 uint64_t |
497 uint64_t |
498 SimulatorTests::NowUs (void) |
498 SimulatorTests::NowUs (void) |
499 { |
499 { |
500 uint64_t ns = Now ().ApproximateToNanoSeconds (); |
500 uint64_t ns = Now ().GetNanoSeconds (); |
501 return ns / 1000; |
501 return ns / 1000; |
502 } |
502 } |
503 void |
503 void |
504 SimulatorTests::A (int a) |
504 SimulatorTests::A (int a) |
505 { |
505 { |