sfepy.base.mem_usage module¶
Memory usage functions.
- sfepy.base.mem_usage.get_mem_usage(obj, usage=None, name=None, traversal_order=None, level=0)[source]¶
Get lower bound of memory usage of an object.
Takes into account strings, numpy arrays and scipy CSR sparse matrices, descends into sequences, mappings and objects.
- Parameters:
- objany object
The object to be measured.
- usagedict
The dict with memory usage records, serving also as a cache of already traversed objects.
- namestr
The name to be given to the object in its record.
- traversal_orderlist, internal
The traversal order of the object.
- levelint, internal
The recurrence level.
- Returns:
- usageint
The object’s lower bound of memory usage.
- sfepy.base.mem_usage.print_mem_usage(usage, order_by='usage', direction='up', print_key=False)[source]¶
Print memory usage dictionary.
- Parameters:
- usagedict
The dict with memory usage records.
- order_by‘usage’, ‘name’, ‘kind’, ‘nrefs’, ‘traversal_order’, or ‘level’
The sorting field name.
- direction‘up’ or ‘down’
The sorting direction.
- print_keybool
If True, print also the record key (object’s id).