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

Function measure

tasks/benchmark.py:116–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114 holder.start()
115
116 async def measure() -> float:
117 task = asyncio.ensure_future(AsyncFileLock(path).acquire(poll_interval=0.01))
118 await asyncio.sleep(0.02)
119 started = time.perf_counter()
120 task.cancel()
121 with suppress(asyncio.CancelledError):
122 await task
123 return time.perf_counter() - started
124
125 try:
126 acquired.wait(timeout=5)

Callers 1

_cancellation_latencyFunction · 0.85

Calls 3

sleepMethod · 0.80
cancelMethod · 0.80
acquireMethod · 0.45

Tested by

no test coverage detected