blob: 8d01549be37f1818966e5a22d9c408a8e1da967f [file] [log] [blame]
Austin Schuh54cf95f2019-11-29 13:14:18 -08001#include "aos/events/event_loop.h"
2
3#include "aos/configuration.h"
4#include "aos/configuration_generated.h"
Tyler Chatow67ddb032020-01-12 14:30:04 -08005#include "aos/logging/implementations.h"
Austin Schuh54cf95f2019-11-29 13:14:18 -08006#include "glog/logging.h"
7
Austin Schuh39788ff2019-12-01 18:22:57 -08008DEFINE_bool(timing_reports, true, "Publish timing reports.");
9DEFINE_int32(timing_report_ms, 1000,
10 "Period in milliseconds to publish timing reports at.");
11
Austin Schuh54cf95f2019-11-29 13:14:18 -080012namespace aos {
Austin Schuhd54780b2020-10-03 16:26:02 -070013namespace {
14void CheckAlignment(const Channel *channel) {
15 if (channel->max_size() % alignof(flatbuffers::largest_scalar_t) != 0) {
16 LOG(FATAL) << "max_size() (" << channel->max_size()
17 << ") is not a multiple of alignment ("
18 << alignof(flatbuffers::largest_scalar_t) << ") for channel "
19 << configuration::CleanedChannelToString(channel) << ".";
20 }
21}
22} // namespace
Austin Schuh54cf95f2019-11-29 13:14:18 -080023
Austin Schuh39788ff2019-12-01 18:22:57 -080024RawSender::RawSender(EventLoop *event_loop, const Channel *channel)
25 : event_loop_(event_loop),
26 channel_(channel),
Brian Silverman79ec7fc2020-06-08 20:11:22 -050027 ftrace_prefix_(configuration::StrippedChannelToString(channel)),
Austin Schuh39788ff2019-12-01 18:22:57 -080028 timing_(event_loop_->ChannelIndex(channel)) {
29 event_loop_->NewSender(this);
30}
31
32RawSender::~RawSender() { event_loop_->DeleteSender(this); }
33
34RawFetcher::RawFetcher(EventLoop *event_loop, const Channel *channel)
35 : event_loop_(event_loop),
36 channel_(channel),
Brian Silverman79ec7fc2020-06-08 20:11:22 -050037 ftrace_prefix_(configuration::StrippedChannelToString(channel)),
Austin Schuh39788ff2019-12-01 18:22:57 -080038 timing_(event_loop_->ChannelIndex(channel)) {
Austin Schuhad154822019-12-27 15:45:13 -080039 context_.monotonic_event_time = monotonic_clock::min_time;
40 context_.monotonic_remote_time = monotonic_clock::min_time;
41 context_.realtime_event_time = realtime_clock::min_time;
42 context_.realtime_remote_time = realtime_clock::min_time;
Austin Schuh39788ff2019-12-01 18:22:57 -080043 context_.queue_index = 0xffffffff;
44 context_.size = 0;
45 context_.data = nullptr;
Brian Silverman4f4e0612020-08-12 19:54:41 -070046 context_.buffer_index = -1;
Austin Schuh39788ff2019-12-01 18:22:57 -080047 event_loop_->NewFetcher(this);
48}
49
50RawFetcher::~RawFetcher() { event_loop_->DeleteFetcher(this); }
51
52TimerHandler::TimerHandler(EventLoop *event_loop, std::function<void()> fn)
53 : event_loop_(event_loop), fn_(std::move(fn)) {}
54
55TimerHandler::~TimerHandler() {}
56
57PhasedLoopHandler::PhasedLoopHandler(EventLoop *event_loop,
58 std::function<void(int)> fn,
59 const monotonic_clock::duration interval,
60 const monotonic_clock::duration offset)
61 : event_loop_(event_loop),
62 fn_(std::move(fn)),
63 phased_loop_(interval, event_loop_->monotonic_now(), offset) {
64 event_loop_->OnRun([this]() {
65 const monotonic_clock::time_point monotonic_now =
66 event_loop_->monotonic_now();
67 phased_loop_.Reset(monotonic_now);
68 Reschedule(
69 [this](monotonic_clock::time_point sleep_time) {
70 Schedule(sleep_time);
71 },
72 monotonic_now);
73 // The first time, we'll double count. Reschedule here will count cycles
74 // elapsed before now, and then the reschedule before runing the handler
75 // will count the time that elapsed then. So clear the count here.
76 cycles_elapsed_ = 0;
77 });
78}
79
80PhasedLoopHandler::~PhasedLoopHandler() {}
81
Austin Schuh20ac95d2020-12-05 17:24:19 -080082EventLoop::EventLoop(const Configuration *configuration, UUID boot_uuid)
83 : boot_uuid_(boot_uuid),
84 timing_report_(flatbuffers::DetachedBuffer()),
Austin Schuh56196432020-10-24 20:15:21 -070085 configuration_(configuration) {}
Tyler Chatow67ddb032020-01-12 14:30:04 -080086
Austin Schuh39788ff2019-12-01 18:22:57 -080087EventLoop::~EventLoop() {
88 CHECK_EQ(senders_.size(), 0u) << ": Not all senders destroyed";
Austin Schuh7d87b672019-12-01 20:23:49 -080089 CHECK_EQ(events_.size(), 0u) << ": Not all events unregistered";
Austin Schuh39788ff2019-12-01 18:22:57 -080090}
91
92int EventLoop::ChannelIndex(const Channel *channel) {
Austin Schuhc9e10ec2020-01-26 16:08:28 -080093 return configuration::ChannelIndex(configuration_, channel);
Austin Schuh39788ff2019-12-01 18:22:57 -080094}
95
Brian Silverman5120afb2020-01-31 17:44:35 -080096WatcherState *EventLoop::GetWatcherState(const Channel *channel) {
97 const int channel_index = ChannelIndex(channel);
98 for (const std::unique_ptr<WatcherState> &watcher : watchers_) {
99 if (watcher->channel_index() == channel_index) {
100 return watcher.get();
101 }
102 }
103 LOG(FATAL) << "No watcher found for channel";
104}
105
Austin Schuh39788ff2019-12-01 18:22:57 -0800106void EventLoop::NewSender(RawSender *sender) {
107 senders_.emplace_back(sender);
108 UpdateTimingReport();
109}
110void EventLoop::DeleteSender(RawSender *sender) {
111 CHECK(!is_running());
112 auto s = std::find(senders_.begin(), senders_.end(), sender);
113 CHECK(s != senders_.end()) << ": Sender not in senders list";
114 senders_.erase(s);
115 UpdateTimingReport();
116}
117
118TimerHandler *EventLoop::NewTimer(std::unique_ptr<TimerHandler> timer) {
119 timers_.emplace_back(std::move(timer));
120 UpdateTimingReport();
121 return timers_.back().get();
122}
123
124PhasedLoopHandler *EventLoop::NewPhasedLoop(
125 std::unique_ptr<PhasedLoopHandler> phased_loop) {
126 phased_loops_.emplace_back(std::move(phased_loop));
127 UpdateTimingReport();
128 return phased_loops_.back().get();
129}
130
131void EventLoop::NewFetcher(RawFetcher *fetcher) {
Austin Schuhd54780b2020-10-03 16:26:02 -0700132 CheckAlignment(fetcher->channel());
133
Austin Schuh39788ff2019-12-01 18:22:57 -0800134 fetchers_.emplace_back(fetcher);
135 UpdateTimingReport();
136}
137
138void EventLoop::DeleteFetcher(RawFetcher *fetcher) {
139 CHECK(!is_running());
140 auto f = std::find(fetchers_.begin(), fetchers_.end(), fetcher);
141 CHECK(f != fetchers_.end()) << ": Fetcher not in fetchers list";
142 fetchers_.erase(f);
143 UpdateTimingReport();
144}
145
146WatcherState *EventLoop::NewWatcher(std::unique_ptr<WatcherState> watcher) {
147 watchers_.emplace_back(std::move(watcher));
148
149 UpdateTimingReport();
150
151 return watchers_.back().get();
152}
153
Brian Silverman0fc69932020-01-24 21:54:02 -0800154void EventLoop::TakeWatcher(const Channel *channel) {
155 CHECK(!is_running()) << ": Cannot add new objects while running.";
156 ChannelIndex(channel);
157
Austin Schuhd54780b2020-10-03 16:26:02 -0700158 CheckAlignment(channel);
159
Brian Silverman0fc69932020-01-24 21:54:02 -0800160 CHECK(taken_senders_.find(channel) == taken_senders_.end())
Austin Schuh8072f922020-02-16 21:51:47 -0800161 << ": " << configuration::CleanedChannelToString(channel)
162 << " is already being used.";
Brian Silverman0fc69932020-01-24 21:54:02 -0800163
164 auto result = taken_watchers_.insert(channel);
Austin Schuh8072f922020-02-16 21:51:47 -0800165 CHECK(result.second) << ": " << configuration::CleanedChannelToString(channel)
Brian Silverman0fc69932020-01-24 21:54:02 -0800166 << " is already being used.";
167
168 if (!configuration::ChannelIsReadableOnNode(channel, node())) {
Austin Schuh8072f922020-02-16 21:51:47 -0800169 LOG(FATAL) << ": " << configuration::CleanedChannelToString(channel)
Brian Silverman0fc69932020-01-24 21:54:02 -0800170 << " is not able to be watched on this node. Check your "
171 "configuration.";
172 }
173}
174
175void EventLoop::TakeSender(const Channel *channel) {
176 CHECK(!is_running()) << ": Cannot add new objects while running.";
177 ChannelIndex(channel);
178
Austin Schuhd54780b2020-10-03 16:26:02 -0700179 CheckAlignment(channel);
180
Brian Silverman0fc69932020-01-24 21:54:02 -0800181 CHECK(taken_watchers_.find(channel) == taken_watchers_.end())
Austin Schuh8072f922020-02-16 21:51:47 -0800182 << ": Channel " << configuration::CleanedChannelToString(channel)
183 << " is already being used.";
Brian Silverman0fc69932020-01-24 21:54:02 -0800184
185 // We don't care if this is a duplicate.
186 taken_senders_.insert(channel);
187}
188
Austin Schuh39788ff2019-12-01 18:22:57 -0800189void EventLoop::SendTimingReport() {
190 // We need to do a fancy dance here to get all the accounting to work right.
191 // We want to copy the memory here, but then send after resetting. Otherwise
192 // the send for the timing report won't be counted in the timing report.
193 //
194 // Also, flatbuffers build from the back end. So place this at the back end
195 // of the buffer. We only have to care because we are using this in a very
196 // raw fashion.
Austin Schuhadd6eb32020-11-09 21:24:26 -0800197 CHECK_LE(timing_report_.span().size(), timing_report_sender_->size())
Austin Schuh39788ff2019-12-01 18:22:57 -0800198 << ": Timing report bigger than the sender size.";
Austin Schuhadd6eb32020-11-09 21:24:26 -0800199 std::copy(timing_report_.span().data(),
200 timing_report_.span().data() + timing_report_.span().size(),
Austin Schuh39788ff2019-12-01 18:22:57 -0800201 reinterpret_cast<uint8_t *>(timing_report_sender_->data()) +
Austin Schuhadd6eb32020-11-09 21:24:26 -0800202 timing_report_sender_->size() - timing_report_.span().size());
Austin Schuh39788ff2019-12-01 18:22:57 -0800203
204 for (const std::unique_ptr<TimerHandler> &timer : timers_) {
205 timer->timing_.ResetTimingReport();
206 }
207 for (const std::unique_ptr<WatcherState> &watcher : watchers_) {
208 watcher->ResetReport();
209 }
210 for (const std::unique_ptr<PhasedLoopHandler> &phased_loop : phased_loops_) {
211 phased_loop->timing_.ResetTimingReport();
212 }
213 for (RawSender *sender : senders_) {
214 sender->timing_.ResetTimingReport();
215 }
216 for (RawFetcher *fetcher : fetchers_) {
217 fetcher->timing_.ResetTimingReport();
218 }
Austin Schuhadd6eb32020-11-09 21:24:26 -0800219 timing_report_sender_->Send(timing_report_.span().size());
Austin Schuh39788ff2019-12-01 18:22:57 -0800220}
221
222void EventLoop::UpdateTimingReport() {
223 // We need to support senders and fetchers changing while we are setting up
224 // the event loop. Otherwise we can't fetch or send until the loop runs. This
225 // means that on each change, we need to redo all this work. This makes setup
226 // more expensive, but not by all that much on a modern processor.
227
228 // Now, build up a report with everything pre-filled out.
229 flatbuffers::FlatBufferBuilder fbb;
Austin Schuhd7b15da2020-02-17 15:06:11 -0800230 fbb.ForceDefaults(true);
Austin Schuh39788ff2019-12-01 18:22:57 -0800231
232 // Pre-fill in the defaults for timers.
233 std::vector<flatbuffers::Offset<timing::Timer>> timer_offsets;
234 for (const std::unique_ptr<TimerHandler> &timer : timers_) {
235 flatbuffers::Offset<timing::Statistic> wakeup_latency_offset =
236 timing::CreateStatistic(fbb);
237 flatbuffers::Offset<timing::Statistic> handler_time_offset =
238 timing::CreateStatistic(fbb);
239 flatbuffers::Offset<flatbuffers::String> name_offset;
240 if (timer->name().size() != 0) {
241 name_offset = fbb.CreateString(timer->name());
242 }
243
244 timing::Timer::Builder timer_builder(fbb);
245
246 if (timer->name().size() != 0) {
247 timer_builder.add_name(name_offset);
248 }
249 timer_builder.add_wakeup_latency(wakeup_latency_offset);
250 timer_builder.add_handler_time(handler_time_offset);
251 timer_builder.add_count(0);
252 timer_offsets.emplace_back(timer_builder.Finish());
253 }
254
255 // Pre-fill in the defaults for phased_loops.
256 std::vector<flatbuffers::Offset<timing::Timer>> phased_loop_offsets;
257 for (const std::unique_ptr<PhasedLoopHandler> &phased_loop : phased_loops_) {
258 flatbuffers::Offset<timing::Statistic> wakeup_latency_offset =
259 timing::CreateStatistic(fbb);
260 flatbuffers::Offset<timing::Statistic> handler_time_offset =
261 timing::CreateStatistic(fbb);
262 flatbuffers::Offset<flatbuffers::String> name_offset;
263 if (phased_loop->name().size() != 0) {
264 name_offset = fbb.CreateString(phased_loop->name());
265 }
266
267 timing::Timer::Builder timer_builder(fbb);
268
269 if (phased_loop->name().size() != 0) {
270 timer_builder.add_name(name_offset);
271 }
272 timer_builder.add_wakeup_latency(wakeup_latency_offset);
273 timer_builder.add_handler_time(handler_time_offset);
274 timer_builder.add_count(0);
275 phased_loop_offsets.emplace_back(timer_builder.Finish());
276 }
277
278 // Pre-fill in the defaults for watchers.
279 std::vector<flatbuffers::Offset<timing::Watcher>> watcher_offsets;
280 for (const std::unique_ptr<WatcherState> &watcher : watchers_) {
281 flatbuffers::Offset<timing::Statistic> wakeup_latency_offset =
282 timing::CreateStatistic(fbb);
283 flatbuffers::Offset<timing::Statistic> handler_time_offset =
284 timing::CreateStatistic(fbb);
285
286 timing::Watcher::Builder watcher_builder(fbb);
287
288 watcher_builder.add_channel_index(watcher->channel_index());
289 watcher_builder.add_wakeup_latency(wakeup_latency_offset);
290 watcher_builder.add_handler_time(handler_time_offset);
291 watcher_builder.add_count(0);
292 watcher_offsets.emplace_back(watcher_builder.Finish());
293 }
294
295 // Pre-fill in the defaults for senders.
296 std::vector<flatbuffers::Offset<timing::Sender>> sender_offsets;
297 for (const RawSender *sender : senders_) {
298 flatbuffers::Offset<timing::Statistic> size_offset =
299 timing::CreateStatistic(fbb);
300
301 timing::Sender::Builder sender_builder(fbb);
302
303 sender_builder.add_channel_index(sender->timing_.channel_index);
304 sender_builder.add_size(size_offset);
305 sender_builder.add_count(0);
306 sender_offsets.emplace_back(sender_builder.Finish());
307 }
308
309 // Pre-fill in the defaults for fetchers.
310 std::vector<flatbuffers::Offset<timing::Fetcher>> fetcher_offsets;
311 for (RawFetcher *fetcher : fetchers_) {
312 flatbuffers::Offset<timing::Statistic> latency_offset =
313 timing::CreateStatistic(fbb);
314
315 timing::Fetcher::Builder fetcher_builder(fbb);
316
317 fetcher_builder.add_channel_index(fetcher->timing_.channel_index);
318 fetcher_builder.add_count(0);
319 fetcher_builder.add_latency(latency_offset);
320 fetcher_offsets.emplace_back(fetcher_builder.Finish());
321 }
322
323 // Then build the final report.
324 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<timing::Timer>>>
325 timers_offset;
326 if (timer_offsets.size() > 0) {
327 timers_offset = fbb.CreateVector(timer_offsets);
328 }
329
330 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<timing::Timer>>>
331 phased_loops_offset;
332 if (phased_loop_offsets.size() > 0) {
333 phased_loops_offset = fbb.CreateVector(phased_loop_offsets);
334 }
335
336 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<timing::Watcher>>>
337 watchers_offset;
338 if (watcher_offsets.size() > 0) {
339 watchers_offset = fbb.CreateVector(watcher_offsets);
340 }
341
342 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<timing::Sender>>>
343 senders_offset;
344 if (sender_offsets.size() > 0) {
345 senders_offset = fbb.CreateVector(sender_offsets);
346 }
347
348 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<timing::Fetcher>>>
349 fetchers_offset;
350 if (fetcher_offsets.size() > 0) {
351 fetchers_offset = fbb.CreateVector(fetcher_offsets);
352 }
353
354 flatbuffers::Offset<flatbuffers::String> name_offset =
355 fbb.CreateString(name());
356
357 timing::Report::Builder report_builder(fbb);
358 report_builder.add_name(name_offset);
359 report_builder.add_pid(GetTid());
360 if (timer_offsets.size() > 0) {
361 report_builder.add_timers(timers_offset);
362 }
363 if (phased_loop_offsets.size() > 0) {
364 report_builder.add_phased_loops(phased_loops_offset);
365 }
366 if (watcher_offsets.size() > 0) {
367 report_builder.add_watchers(watchers_offset);
368 }
369 if (sender_offsets.size() > 0) {
370 report_builder.add_senders(senders_offset);
371 }
372 if (fetcher_offsets.size() > 0) {
373 report_builder.add_fetchers(fetchers_offset);
374 }
375 fbb.Finish(report_builder.Finish());
376
377 timing_report_ = FlatbufferDetachedBuffer<timing::Report>(fbb.Release());
378
379 // Now that the pointers are stable, pass them to the timers and watchers to
380 // be updated.
381 for (size_t i = 0; i < timers_.size(); ++i) {
382 timers_[i]->timing_.set_timing_report(
383 timing_report_.mutable_message()->mutable_timers()->GetMutableObject(
384 i));
385 }
386
387 for (size_t i = 0; i < phased_loops_.size(); ++i) {
388 phased_loops_[i]->timing_.set_timing_report(
389 timing_report_.mutable_message()
390 ->mutable_phased_loops()
391 ->GetMutableObject(i));
392 }
393
394 for (size_t i = 0; i < watchers_.size(); ++i) {
395 watchers_[i]->set_timing_report(
396 timing_report_.mutable_message()->mutable_watchers()->GetMutableObject(
397 i));
398 }
399
400 for (size_t i = 0; i < senders_.size(); ++i) {
401 senders_[i]->timing_.set_timing_report(
402 timing_report_.mutable_message()->mutable_senders()->GetMutableObject(
403 i));
404 }
405
406 for (size_t i = 0; i < fetchers_.size(); ++i) {
407 fetchers_[i]->timing_.set_timing_report(
408 timing_report_.mutable_message()->mutable_fetchers()->GetMutableObject(
409 i));
410 }
411}
412
413void EventLoop::MaybeScheduleTimingReports() {
414 if (FLAGS_timing_reports && !skip_timing_report_) {
415 CHECK(!timing_report_sender_) << ": Timing reports already scheduled.";
416 // Make a raw sender for the report.
417 const Channel *channel = configuration::GetChannel(
418 configuration(), "/aos", timing::Report::GetFullyQualifiedName(),
Austin Schuhbca6cf02019-12-22 17:28:34 -0800419 name(), node());
Austin Schuh196a4452020-03-15 23:12:03 -0700420 CHECK(channel != nullptr) << ": Failed to look up {\"name\": \"/aos\", "
421 "\"type\": \"aos.timing.Report\"} on node "
422 << FlatbufferToJson(node());
Austin Schuhbca6cf02019-12-22 17:28:34 -0800423
424 // Since we are using a RawSender, validity isn't checked. So check it
425 // ourselves.
Austin Schuhca4828c2019-12-28 14:21:35 -0800426 if (!configuration::ChannelIsSendableOnNode(channel, node())) {
427 LOG(FATAL) << "Channel { \"name\": \"/aos"
428 << channel->name()->string_view() << "\", \"type\": \""
429 << channel->type()->string_view()
430 << "\" } is not able to be sent on this node. Check your "
431 "configuration.";
Austin Schuhbca6cf02019-12-22 17:28:34 -0800432 }
Austin Schuh39788ff2019-12-01 18:22:57 -0800433 CHECK(channel != nullptr) << ": Channel { \"name\": \"/aos\", \"type\": \""
434 << timing::Report::GetFullyQualifiedName()
435 << "\" } not found in config.";
436 timing_report_sender_ = MakeRawSender(channel);
437
438 // Register a handler which sends the report out by copying the raw data
439 // from the prebuilt and subsequently modified report.
440 TimerHandler *timing_reports_timer =
441 AddTimer([this]() { SendTimingReport(); });
442
443 // Set it up to send once per second.
444 timing_reports_timer->set_name("timing_reports");
445 OnRun([this, timing_reports_timer]() {
446 timing_reports_timer->Setup(
447 monotonic_now() + std::chrono::milliseconds(FLAGS_timing_report_ms),
448 std::chrono::milliseconds(FLAGS_timing_report_ms));
449 });
450
451 UpdateTimingReport();
452 }
453}
454
Austin Schuh7d87b672019-12-01 20:23:49 -0800455void EventLoop::ReserveEvents() {
456 events_.reserve(timers_.size() + phased_loops_.size() + watchers_.size());
457}
458
459namespace {
460bool CompareEvents(const EventLoopEvent *first, const EventLoopEvent *second) {
Brian Silvermanbd405c02020-06-23 16:25:23 -0700461 if (first->event_time() > second->event_time()) {
462 return true;
463 }
464 if (first->event_time() < second->event_time()) {
465 return false;
466 }
467 return first->generation() > second->generation();
Austin Schuh7d87b672019-12-01 20:23:49 -0800468}
469} // namespace
470
471void EventLoop::AddEvent(EventLoopEvent *event) {
472 DCHECK(std::find(events_.begin(), events_.end(), event) == events_.end());
Brian Silvermanbd405c02020-06-23 16:25:23 -0700473 DCHECK(event->generation() == 0);
474 event->set_generation(++event_generation_);
Austin Schuh7d87b672019-12-01 20:23:49 -0800475 events_.push_back(event);
476 std::push_heap(events_.begin(), events_.end(), CompareEvents);
477}
478
479void EventLoop::RemoveEvent(EventLoopEvent *event) {
480 auto e = std::find(events_.begin(), events_.end(), event);
481 if (e != events_.end()) {
Brian Silvermanbd405c02020-06-23 16:25:23 -0700482 DCHECK(event->generation() != 0);
Austin Schuh7d87b672019-12-01 20:23:49 -0800483 events_.erase(e);
484 std::make_heap(events_.begin(), events_.end(), CompareEvents);
485 event->Invalidate();
486 }
487}
488
489EventLoopEvent *EventLoop::PopEvent() {
490 EventLoopEvent *result = events_.front();
491 std::pop_heap(events_.begin(), events_.end(), CompareEvents);
492 events_.pop_back();
493 result->Invalidate();
494 return result;
495}
496
Austin Schuh39788ff2019-12-01 18:22:57 -0800497void WatcherState::set_timing_report(timing::Watcher *watcher) {
498 CHECK_NOTNULL(watcher);
499 watcher_ = watcher;
500 wakeup_latency_.set_statistic(watcher->mutable_wakeup_latency());
501 handler_time_.set_statistic(watcher->mutable_handler_time());
502}
503
504void WatcherState::ResetReport() {
505 wakeup_latency_.Reset();
506 handler_time_.Reset();
507 watcher_->mutate_count(0);
Austin Schuh54cf95f2019-11-29 13:14:18 -0800508}
509
510} // namespace aos