Skip to content

Commit a482807

Browse files
committed
test expr profiling
1 parent 97cc401 commit a482807

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test_expression_profiling.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from __future__ import annotations
2+
3+
import activitysim.abm # register components
4+
from activitysim.core import timing, workflow
5+
6+
7+
def test_expression_profiling():
8+
state = workflow.create_example("prototype_mtc", temp=True)
9+
10+
state.settings.expression_profile = True
11+
state.run.all()
12+
13+
# generate a summary of slower expression evaluation times
14+
# across all models and write to a file
15+
analyze = timing.AnalyzeEvalTiming(state)
16+
analyze.component_report(style=state.settings.expression_profile_style)
17+
analyze.subcomponent_report(style=state.settings.expression_profile_style)
18+
19+
workdir = state.filesystem.working_dir
20+
outdir = workdir.joinpath(state.filesystem.output_dir)
21+
assert outdir.joinpath(
22+
"log/expr-performance/expression-timing-subcomponents.html"
23+
).exists()
24+
assert outdir.joinpath(
25+
"log/expr-performance/expression-timing-components.html"
26+
).exists()
27+
assert outdir.joinpath(
28+
"log/expr-performance/tour_mode_choice.work.simple_simulate.eval_nl.eval_utils.log"
29+
).exists()

0 commit comments

Comments
 (0)