| 76 | } |
| 77 | |
| 78 | void PingPongSequencedLatencyTest::Pinger::onEvent(ValueEvent& data, std::int64_t /*sequence*/, bool /*endOfBatch*/) |
| 79 | { |
| 80 | auto t1 = Stopwatch::getTimestamp(); |
| 81 | |
| 82 | m_latencyRecorder->record(LatencyTestSession::convertStopwatchTicksToNano((double)(t1 - m_t0))); |
| 83 | |
| 84 | if (data.value < m_maxEvents) |
| 85 | { |
| 86 | while (m_pauseDurationInNanos > (Stopwatch::getTimestamp() - t1)) |
| 87 | { |
| 88 | std::this_thread::sleep_for(std::chrono::milliseconds(0)); |
| 89 | } |
| 90 | |
| 91 | send(); |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | m_signal->set(); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | void PingPongSequencedLatencyTest::Pinger::onStart() |
| 100 | { |