MCPcopy Create free account
hub / github.com/apache/trafficserver / waitForActivity

Method waitForActivity

src/iocore/net/NetHandler.cc:340–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340int
341NetHandler::waitForActivity(ink_hrtime timeout)
342{
343 EventIO *epd = nullptr;
344#if TS_USE_LINUX_IO_URING
345 IOUringContext *ur = IOUringContext::local_context();
346#endif
347
348 Metrics::Counter::increment(net_rsb.handler_run);
349 SCOPED_MUTEX_LOCK(lock, mutex, this->thread);
350
351 process_enabled_list();
352
353#if TS_USE_LINUX_IO_URING
354 ur->submit();
355#endif
356
357 // Polling event by PollCont
358 PollCont *p = get_PollCont(this->thread);
359 ink_hrtime pre_poll = ink_get_hrtime();
360 p->do_poll(timeout);
361 ink_hrtime post_poll = ink_get_hrtime();
362 ink_hrtime poll_time = post_poll - pre_poll;
363
364 // Get & Process polling result
365 PollDescriptor *pd = get_PollDescriptor(this->thread);
366 for (int x = 0; x < pd->result; x++) {
367 epd = static_cast<EventIO *> get_ev_data(pd, x);
368 int flags = get_ev_events(pd, x);
369 epd->process_event(flags);
370 ev_next_event(pd, x);
371 }
372
373 pd->result = 0;
374
375 process_ready_list();
376 ink_hrtime post_process = ink_get_hrtime();
377 ink_hrtime process_time = post_process - post_poll;
378 this->thread->metrics.current_slice.load(std::memory_order_acquire)->record_io_stats(poll_time, process_time);
379
380#if TS_USE_LINUX_IO_URING
381 ur->service();
382#endif
383
384 return EVENT_CONT;
385}
386
387void
388NetHandler::signalActivity()

Callers 1

mainNetEventMethod · 0.95

Calls 10

incrementFunction · 0.85
get_PollContFunction · 0.85
ink_get_hrtimeFunction · 0.85
get_PollDescriptorFunction · 0.85
submitMethod · 0.80
do_pollMethod · 0.80
record_io_statsMethod · 0.80
process_eventMethod · 0.45
loadMethod · 0.45
serviceMethod · 0.45

Tested by

no test coverage detected