# Records the swaption in swaption.py (same folder) with the AADC Tracer and prints the
# price and the two counts quoted on matlogica.com/products/aadc-tracer.
#
#   python3 -m venv tracer && . tracer/bin/activate
#   pip install "aadc==2.25.2" "aadc-quantlib-tracing==1.41.4"
#   python swaption_trace.py
#
# Measured 22 October 2026 (aadc-quantlib-tracing 1.41.4, aadc 2.25.2, Python 3.11,
# Linux x86-64): 16912.75857915684, then 150, then 59.
import aadc
from aadc_quantlib_tracing import QuantLib as ql
from swaption import price

f = aadc.Functions()
f.start_recording(trace=True, trace_inputs_as_random=True)
npv = price(ql)
f.stop_recording()

print(npv)                                                            # 16912.75857915684
print(len({(l["file"], l["line"]) for l in f.traced_leaves()}))      # 150 constant sites
print(len({(w["file"], w["line"]) for w in f.passive_warnings()}))   # 59 frozen-branch sites
