优化仿真求解性能并修复流量闭合问题(初版)
This commit is contained in:
1 parent
57b459bc72
commit
5332a788f3
55 files changed
+8973
-549
No files matched your search
@@ -654,6 +654,29 @@ def record_property_iterations(
|
||||
)
|
||||
|
||||
|
||||
def record_property_cache(operation: str, *, hit: bool) -> None:
|
||||
"""Record one run-local property-cache lookup in audit mode."""
|
||||
|
||||
trace = _CURRENT_TRACE.get()
|
||||
if trace is None or trace.mode != "audit":
|
||||
return
|
||||
for frame in reversed(_ACTIVE_SPANS.get()):
|
||||
if (
|
||||
frame.property_key is not None
|
||||
and frame.property_operation == operation
|
||||
):
|
||||
layer, medium, _unused_operation = frame.property_key.split("|", 2)
|
||||
trace._record_cache(
|
||||
frame.property_key,
|
||||
operation=operation,
|
||||
layer=layer,
|
||||
medium=medium,
|
||||
hits=1 if hit else 0,
|
||||
misses=0 if hit else 1,
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
__all__ = [
|
||||
"PROFILE_MODE",
|
||||
"PerformanceTrace",
|
||||
@@ -661,5 +684,6 @@ __all__ = [
|
||||
"profile_phase",
|
||||
"profile_property",
|
||||
"profile_run",
|
||||
"record_property_cache",
|
||||
"record_property_iterations",
|
||||
]
|
||||
Reference in new issue
Block a user