MCPcopy Create free account
hub / github.com/tox-dev/filelock / measure

Function measure

tasks/benchmark.py:129–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127 holder.start()
128
129 async def measure() -> float:
130 waiter = AsyncFileLock(path)
131 task = asyncio.ensure_future(waiter.acquire(poll_interval=0.01))
132 await asyncio.sleep(0.02)
133 started = time.perf_counter()
134 task.cancel()
135 with suppress(asyncio.CancelledError):
136 await task
137 return time.perf_counter() - started
138
139 try:
140 acquired.wait(timeout=5)

Callers 1

_cancellation_latencyFunction · 0.85

Calls 2

cancelMethod · 0.80
acquireMethod · 0.45

Tested by

no test coverage detected