public HeapMetricNode(HeapStructureNode heapNode, string idSuffix, string name, Func <ParsedHeapState, int> callback) : base(heapNode.UniqueID + idSuffix) { Name = name; _Callback = callback; _HeapNode = heapNode; SelectedFormatter = _HeapNode._Root.Engine.GetDefaultFormatter(ScalarVariableType.SInt32); }
protected int ProvideEstimatedStackSize(out ulong pxStack) { if (!_StackSizeQueried) { _StackSizeQueried = true; if (_ThreadNode._Variables.pxStack != null && _ThreadNode._Variables.pxTopOfStack != null) { int pointerSize = _ThreadNode._Variables.pxStack.Size; ulong allocatedMask = HeapStructureNode.GetBlockAllocatedMask(pointerSize >= 8); _pxStack = _ThreadNode._Engine.ReadMemory(_ThreadNode._Variables.pxStack).ToUlong(); ulong pxTopOfStack = _ThreadNode._Variables.pxTopOfStackLive.GetValue().ToUlong(); if (_pxStack != 0 && pxTopOfStack != 0) { if (_ThreadNode._ucHeap != null && _pxStack >= _ThreadNode._ucHeap.Address && _pxStack < (_ThreadNode._ucHeap.Address + (uint)_ThreadNode._ucHeap.Size)) { //The logic below will only work if the stack was allocated from the FreeRTOS heap (tested with heap_4). ulong heapBlockSize = _ThreadNode._Engine.Memory.ReadMemory(_pxStack - (uint)pointerSize, pointerSize).ToUlong(); if ((heapBlockSize & allocatedMask) != 0) { _EstimatedStackSize = (int)(heapBlockSize & ~allocatedMask) - 2 * pointerSize; } } else { var fixedStackVariable = _ThreadNode._Engine.Symbols.TopLevelVariables.FirstOrDefault(v => v.Address == _pxStack && v.Size != 0); if (fixedStackVariable != null) { _EstimatedStackSize = fixedStackVariable.Size; } } } } } pxStack = _pxStack; return(_EstimatedStackSize); }
public HeapBlockNode(HeapStructureNode heapNode, int index) : base($"{heapNode.UniqueID}[{index}]") { _HeapNode = heapNode; _Index = index; }
public HeapMetricNode(HeapStructureNode heapNode, string idSuffix, string name, Func <ParsedHeapState, long> callback) : this(heapNode, idSuffix, name, s => (int)callback(s)) { }