Skip to content

Commit 388f679

Browse files
committed
Add runtime tracking for type tracing executions and time overhead
1 parent b2266a9 commit 388f679

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/pynguin/testcase/execution.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import signal
2323
import sys
2424
import threading
25+
import time
2526
from abc import abstractmethod
2627
from pathlib import Path
2728
from queue import Empty, Queue
@@ -2090,7 +2091,12 @@ def execute(self, test_case: tc.TestCase) -> ExecutionResult: # noqa: D102
20902091
):
20912092
# TODO(fk) Do we record wrong stuff, i.e., type checks from observers?
20922093
# Make use of type errors?
2094+
start = time.time_ns()
20932095
self._delegate.execute(test_case)
2096+
stat.add_to_runtime_variable(
2097+
RuntimeVariable.TypeTracingTime, time.time_ns() - start
2098+
)
2099+
stat.add_to_runtime_variable(RuntimeVariable.TypeTracingExecutions, 1)
20942100
return result
20952101

20962102

src/pynguin/utils/statistics/runtimevariable.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ class RuntimeVariable(str, enum.Enum):
151151
# Number of executed test cases
152152
Executed = "Executed"
153153

154+
# Number of additional test case executions caused by type tracing
155+
TypeTracingExecutions = "TypeTracingExecutions"
156+
157+
# Time overhead (ns) caused by type tracing executions
158+
TypeTracingTime = "TypeTracingTime"
159+
154160
# ========= Values collected at the end of the search =========
155161

156162
# Total number of statements in the resulting test suite

0 commit comments

Comments
 (0)