Skip to content
Snippets Groups Projects
Commit 7d5603b1 authored by René Heß's avatar René Heß
Browse files

Option to store stack for chace objects

parent 60a11b54
No related branches found
No related tags found
No related merge requests found
""" This module provides the memoization infrastructure for code
generating functions.
"""
import inspect
from dune.perftool.generation.context import (get_global_context_value,
global_context,
)
from dune.perftool.generation.counter import get_counter
from dune.perftool.options import get_option
# Store a global list of generator functions
_generators = []
......@@ -53,7 +56,9 @@ class _CacheObject(object):
def __init__(self, value, count=None):
self.value = value
self.count = count
self.stackframe = None
self.stack = None
if get_option('debug_cache_with_stack'):
self.stack = inspect.stack()
class _RegisteredFunction(object):
......
......@@ -34,6 +34,7 @@ class PerftoolOptionsArray(ImmutableRecord):
# Arguments that are to be set from the outside
uflfile = PerftoolOption(helpstr="the UFL file to compile")
debug_cache_with_stack = PerftoolOption(default=False, helpstr="Store stack along with cache objects. Makes debugging caching issues easier.")
driver_file = PerftoolOption(helpstr="The filename for the generated driver header")
operator_file = PerftoolOption(helpstr="The filename for the generated local operator header")
numerical_jacobian = PerftoolOption(default=False, helpstr="use numerical jacobians (only makes sense, if uflpdelab for some reason fails to generate analytic jacobians)")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment