private void BuildClassTrace(Graph graph, int stackTraceIndex, int funcIndex, ulong size, Vertex[] funcVertex, ref Vertex[] vertexStack, FilterForm filterForm) { string className = ClassNameOfFunc(funcIndex); int functionsToSkip = FunctionsInSameClass(className, stackTraceIndex); int stackPtr = BuildVertexStack(stackTraceIndex, funcVertex, ref vertexStack, 0) - functionsToSkip; Vertex toVertex = graph.TopVertex; if (ReadNewLog.InterestingCallStack(vertexStack, stackPtr, filterForm)) { vertexStack[stackPtr] = graph.FindOrCreateVertex(className, null, null); vertexStack[stackPtr].interestLevel = filterForm.IsInterestingMethodName(className, null) ? InterestLevel.Interesting | filterForm.InterestLevelForParentsAndChildren() : InterestLevel.Ignore; stackPtr++; stackPtr = ReadNewLog.FilterVertices(vertexStack, stackPtr); stackPtr = Vertex.SqueezeOutRepetitions(vertexStack, stackPtr); Edge edge; Vertex fromVertex; for (int i = 0; i < stackPtr; i++) { fromVertex = toVertex; toVertex = vertexStack[i]; edge = graph.FindOrCreateEdge(fromVertex, toVertex); edge.AddWeight(size); } if (toVertex != graph.TopVertex) { fromVertex = toVertex; toVertex = graph.BottomVertex; edge = graph.FindOrCreateEdge(fromVertex, toVertex); edge.AddWeight(size); } } }
internal void AssignInterestLevelToObject(ulong id, GcObject gcObject, BuildTypeGraphOptions options, FilterForm filterForm, bool isRoot) { bool isInteresting = gcObject.Type(this).interestLevel == InterestLevel.Interesting && filterForm.IsInterestingAddress(id); if (isInteresting && filterForm.signatureFilters.Length != 0) { string signature = SignatureOfObject(id, gcObject, BuildTypeGraphOptions.LumpBySignature); isInteresting = filterForm.IsInterestingTypeName(gcObject.Type(this).name, signature, readNewLog.finalizableTypes.ContainsKey(gcObject.Type(this).typeID)); } if (isInteresting) { gcObject.InterestLevel = InterestLevel.Interesting; if (!isRoot) { gcObject.InterestLevel |= filterForm.InterestLevelForParentsAndChildren(); } } else { gcObject.InterestLevel = InterestLevel.Ignore; } // Check if this is an interesting object, and we are supposed to mark its ancestors if ((gcObject.InterestLevel & InterestLevel.InterestingParents) == InterestLevel.InterestingParents) { for (GcObject parentObject = gcObject.parent; parentObject != null; parentObject = parentObject.parent) { // As long as we find uninteresting objects, mark them for display // When we find an interesting object, we stop, because either it // will itself mark its parents, or it isn't interested in them (and we // respect that despite the interest of the current object, somewhat arbitrarily). if ((parentObject.InterestLevel & InterestLevel.InterestingParents) == InterestLevel.Ignore) { parentObject.InterestLevel |= InterestLevel.Display; } else { break; } } } // It's tempting here to mark the descendants as well, but they may be reached via // long reference paths, when there are shorter ones that were deemed uninteresting // Instead, we look whether our parent objects are interesting and want to show their // descendants, but we have to do that in a separate pass. }
internal void AddFunctionVertex(int funcId, string functionName, string signature, Graph graph, ref Vertex[] funcVertex, FilterForm filterForm) { EnsureVertexCapacity(funcId, ref funcVertex); int moduleId = funcModule[funcId]; string moduleName = null; if (moduleId >= 0) moduleName = modBasicName[moduleId]; funcVertex[funcId] = graph.FindOrCreateVertex(functionName, signature, moduleName); funcVertex[funcId].interestLevel = filterForm.IsInterestingMethodName(functionName, signature) ? InterestLevel.Interesting | filterForm.InterestLevelForParentsAndChildren() : InterestLevel.Ignore; }
internal void AddTypeVertex(int typeId, string typeName, Graph graph, ref Vertex[] typeVertex, FilterForm filterForm) { EnsureVertexCapacity(typeId, ref typeVertex); typeVertex[typeId] = graph.FindOrCreateVertex(typeName, null, null); typeVertex[typeId].interestLevel = filterForm.IsInterestingTypeName(typeName, null, finalizableTypes.ContainsKey(typeId)) ? InterestLevel.Interesting | filterForm.InterestLevelForParentsAndChildren() : InterestLevel.Ignore; }
void BuildClassTrace(Graph graph, int stackTraceIndex, int funcIndex, ulong size, Vertex[] funcVertex, ref Vertex[] vertexStack, FilterForm filterForm) { string className = ClassNameOfFunc(funcIndex); int functionsToSkip = FunctionsInSameClass(className, stackTraceIndex); int stackPtr = BuildVertexStack(stackTraceIndex, funcVertex, ref vertexStack, 0) - functionsToSkip; Vertex toVertex = graph.TopVertex; Vertex fromVertex; Edge edge; if (ReadNewLog.InterestingCallStack(vertexStack, stackPtr, filterForm)) { vertexStack[stackPtr] = graph.FindOrCreateVertex(className, null, null); vertexStack[stackPtr].interestLevel = filterForm.IsInterestingMethodName(className, null) ? InterestLevel.Interesting | filterForm.InterestLevelForParentsAndChildren() : InterestLevel.Ignore; stackPtr++; stackPtr = ReadNewLog.FilterVertices(vertexStack, stackPtr); stackPtr = Vertex.SqueezeOutRepetitions(vertexStack, stackPtr); for (int i = 0; i < stackPtr; i++) { fromVertex = toVertex; toVertex = vertexStack[i]; edge = graph.FindOrCreateEdge(fromVertex, toVertex); edge.AddWeight(size); } if (toVertex != graph.TopVertex) { fromVertex = toVertex; toVertex = graph.BottomVertex; edge = graph.FindOrCreateEdge(fromVertex, toVertex); edge.AddWeight(size); } } }