Activate stack tracing.

Start tracing the call stack of formula calculations held internally in modelx.

The tracing is useful when the user wants to get the information on the execution of cells formulas, such as how much time each formula takes from start to finish, or what formulas are called in what order to identify performance bottlenecks.

While the tracing is active, the history of loading and unloading cells and its arguments to/from the call stack is recorded with timestamps and available through calling get_stacktrace() function. The tracing continues until the user calls stop_stacktrace().


Activating stack tracing may slow down formula calculations. You should activate it only when needed for inspection purposes.


maxlen (int, optional) – Max number of records to be kept. When exceeding, records are removed from the oldest. Defaults to 10000.

Changed in version 0.1.0: maxlen parameter is added.

Added in version 0.0.25.