MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_timerfd_select

Method test_timerfd_select

Lib/test/test_os.py:4434–4456  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4432 self.assertGreater(t, offset - self.CLOCK_RES)
4433
4434 def test_timerfd_select(self):
4435 fd = self.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)
4436
4437 rfd, wfd, xfd = select.select([fd], [fd], [fd], 0)
4438 self.assertEqual((rfd, wfd, xfd), ([], [], []))
4439
4440 # 0.25 second
4441 initial_expiration = 0.25
4442 # every 0.125 second
4443 interval = 0.125
4444
4445 os.timerfd_settime(fd, initial=initial_expiration, interval=interval)
4446
4447 count = 3
4448 t = time.perf_counter()
4449 for _ in range(count):
4450 rfd, wfd, xfd = select.select([fd], [fd], [fd], initial_expiration + interval)
4451 self.assertEqual((rfd, wfd, xfd), ([fd], [], []))
4452 self.assertEqual(self.read_count_signaled(fd), 1)
4453 t = time.perf_counter() - t
4454
4455 total_time = initial_expiration + interval * (count - 1)
4456 self.assertGreater(t, total_time - self.CLOCK_RES)
4457
4458 def check_timerfd_poll(self, nanoseconds):
4459 fd = self.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)

Callers

nothing calls this directly

Calls 5

timerfd_createMethod · 0.95
read_count_signaledMethod · 0.95
assertGreaterMethod · 0.80
selectMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected