Compare commits
No commits in common. "b6184ab74e76c7a3a2f2b1486b7cb231ff3cdeed" and "cac5086153cbbebd37fd210e53e402a545172f9d" have entirely different histories.
b6184ab74e
...
cac5086153
|
|
@ -77,13 +77,9 @@ def _pkg_max_mhz() -> int:
|
|||
|
||||
|
||||
def _burn(stop: float) -> None:
|
||||
# fixed-width (64-bit-masked) arithmetic keeps this a steady
|
||||
# ALU load; an unmasked `x` grows ~x**2/iter into a huge bigint,
|
||||
# degenerating into noisy alloc/mul-bound work (and needless
|
||||
# memory) across N procs.
|
||||
x: int = 1
|
||||
while time.perf_counter() < stop:
|
||||
x = (x + (x * x ^ 0x5)) & 0xFFFF_FFFF_FFFF_FFFF
|
||||
x += x * x ^ 0x5
|
||||
|
||||
|
||||
def main(
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ def _measure_sustained_headroom(
|
|||
|
||||
def _read_mhz(path: str) -> int|None:
|
||||
try:
|
||||
with open(path) as f:
|
||||
return int(f.read()) // 1000
|
||||
return int(open(path).read()) // 1000
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
|
@ -188,13 +187,9 @@ def _measure_sustained_headroom(
|
|||
return 1.
|
||||
|
||||
def _burn(stop: float) -> None:
|
||||
# fixed-width (64-bit-masked) arithmetic keeps this a
|
||||
# steady ALU load; an unmasked `x` grows ~x**2/iter into
|
||||
# a huge bigint, degenerating into noisy alloc/mul-bound
|
||||
# work (and needless memory) across N procs.
|
||||
x: int = 1
|
||||
while time.perf_counter() < stop:
|
||||
x = (x + (x * x ^ 0x5)) & 0xFFFF_FFFF_FFFF_FFFF
|
||||
x += x * x ^ 0x5
|
||||
|
||||
# explicit `fork` ctx so we're immune to whatever global
|
||||
# mp start-method tractor/the suite may have set (`spawn`
|
||||
|
|
|
|||
|
|
@ -50,14 +50,9 @@ def get_rando_addr(
|
|||
fight over the bind, cascading into a chain of
|
||||
"Address already in use" failures.
|
||||
|
||||
For UDS the *cross*-process concern is handled by keying
|
||||
socket paths off `os.getpid()` (each pytest process gets its
|
||||
own namespace). *Within* a process — where `get_random()` has
|
||||
no live runtime to name from — it also appends a per-call
|
||||
`uuid4` token, so two calls (e.g. a `reg_addr` + a distinct
|
||||
bind addr in one test body) yield distinct sockpaths rather
|
||||
than aliasing to the same `name@pid.sock` and tripping
|
||||
`EADDRINUSE`.
|
||||
For UDS this concern doesn't apply: `UDSAddress.get_random()`
|
||||
already builds socket paths from `os.getpid()` so each
|
||||
pytest process gets its own socket-path namespace.
|
||||
|
||||
'''
|
||||
addr_type: Type[_addr.Addres] = _addr._address_types[tpt_proto]
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ from typing import (
|
|||
TYPE_CHECKING,
|
||||
ClassVar,
|
||||
)
|
||||
from uuid import uuid4
|
||||
|
||||
import msgspec
|
||||
import trio
|
||||
|
|
@ -205,16 +204,7 @@ class UDSAddress(
|
|||
else:
|
||||
prefix: str = 'no_runtime_actor'
|
||||
|
||||
# XXX, no live actor -> no `Aid` to key off, so append a
|
||||
# per-CALL token: w/o a runtime the sockname is otherwise
|
||||
# a pure fn of `(prefix, pid)`, so two `get_random()`
|
||||
# calls in one proc alias to the SAME sockpath and the
|
||||
# 2nd `.bind()` trips `EADDRINUSE`. The token makes each
|
||||
# call a distinct file. Safe vs `._reap` cleanup which
|
||||
# only reconstructs the runtime `{name}@{pid}` convention
|
||||
# (above), never these `no_runtime_*` socks.
|
||||
token: str = uuid4().hex[:6]
|
||||
sockname: str = f'{prefix}@{pid}.{token}'
|
||||
sockname: str = f'{prefix}@{pid}'
|
||||
|
||||
sockpath: Path = Path(f'{sockname}.sock')
|
||||
return UDSAddress(
|
||||
|
|
|
|||
Loading…
Reference in New Issue