本文整理汇总了C#中CLRProfiler.Vertex类的典型用法代码示例。如果您正苦于以下问题:C# Vertex类的具体用法?C# Vertex怎么用?C# Vertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vertex类属于CLRProfiler命名空间,在下文中一共展示了Vertex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Graph
internal Graph(object graphSource)
{
this.graphSource = graphSource;
vertices = new Dictionary<string, Vertex>();
topVertex = FindOrCreateVertex("<root>", null, null);
bottomVertex = FindOrCreateVertex("<bottom>", null, null);
}
示例2: BuildAllocationTrace
internal void BuildAllocationTrace(Graph graph, int stackTraceIndex, int typeIndex, ulong size, Vertex[] typeVertex, Vertex[] funcVertex, ref Vertex[] vertexStack, FilterForm filterForm)
{
int stackPtr = BuildVertexStack(stackTraceIndex, funcVertex, ref vertexStack, 2);
Vertex toVertex = graph.TopVertex;
Vertex fromVertex;
Edge edge;
if ((typeVertex[typeIndex].interestLevel & InterestLevel.Interesting) == InterestLevel.Interesting
&& ReadNewLog.InterestingCallStack(vertexStack, stackPtr, filterForm))
{
vertexStack[stackPtr] = typeVertex[typeIndex];
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);
}
fromVertex = toVertex;
toVertex = graph.BottomVertex;
edge = graph.FindOrCreateEdge(fromVertex, toVertex);
edge.AddWeight(size);
}
}
示例3: FindOrCreateVertex
internal Vertex FindOrCreateVertex(string name, string signature, string module)
{
string nameSignatureModule = NameSignatureModule(name, signature, module);
Vertex vertex;
if (!vertices.TryGetValue(nameSignatureModule, out vertex))
{
vertex = new Vertex(name, signature, module, this);
vertices[nameSignatureModule] = vertex;
}
return vertex;
}
示例4: SelectedVertexCount
public int SelectedVertexCount(out Vertex selectedVertex)
{
int selectedCount = 0;
selectedVertex = null;
foreach (Vertex v in graph.vertices.Values)
{
if (v.selected)
{
selectedCount++;
selectedVertex = v;
}
}
return selectedCount;
}
示例5: BuildVertexStack
internal int BuildVertexStack(int stackTraceIndex, Vertex[] funcVertex, ref Vertex[] vertexStack, int skipCount)
{
int[] stackTrace = readNewLog.stacktraceTable.IndexToStacktrace(stackTraceIndex);
while (vertexStack.Length < stackTrace.Length + 3)
{
vertexStack = new Vertex[vertexStack.Length*2];
}
for (int i = skipCount; i < stackTrace.Length; i++)
{
vertexStack[i-skipCount] = funcVertex[stackTrace[i]];
}
return stackTrace.Length - skipCount;
}
示例6: EnsureVertexCapacity
static void EnsureVertexCapacity(int id, ref Vertex[] vertexArray)
{
Debug.Assert(id >= 0);
if (id < vertexArray.Length)
return;
int newLength = vertexArray.Length*2;
if (newLength <= id)
newLength = id + 1;
Vertex[] newVertexArray = new Vertex[newLength];
Array.Copy(vertexArray, 0, newVertexArray, 0, vertexArray.Length);
vertexArray = newVertexArray;
}
示例7: AddTypeVertex
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.InterestLevelOfTypeName(typeName, null, finalizableTypes.ContainsKey(typeId));
}
示例8: Score
private double Score(Vertex v)
{
return v.weight*(Diversity(v.incomingEdges) + Diversity(v.outgoingEdges));
}
示例9: BuildTypeVertices
internal void BuildTypeVertices(Graph graph, ref Vertex[] typeVertex, FilterForm filterForm)
{
for (int i = 0; i < readNewLog.typeName.Length; i++)
{
string typeName = readNewLog.typeName[i];
if (typeName == null)
typeName = string.Format("???? type {0}", i);
readNewLog.AddTypeVertex(i, typeName, graph, ref typeVertex, filterForm);
}
}
示例10: FilterVertices
internal static int FilterVertices(Vertex[] vertexStack, int stackPtr)
{
bool display = false;
for (int i = 0; i < stackPtr; i++)
{
Vertex vertex = vertexStack[i];
switch (vertex.interestLevel & InterestLevel.InterestingChildren)
{
case InterestLevel.Ignore:
if (display)
vertex.interestLevel |= InterestLevel.Display;
break;
case InterestLevel.InterestingChildren:
display = true;
break;
default:
display = false;
break;
}
}
display = false;
for (int i = stackPtr-1; i >= 0; i--)
{
Vertex vertex = vertexStack[i];
switch (vertex.interestLevel & InterestLevel.InterestingParents)
{
case InterestLevel.Ignore:
if (display)
vertex.interestLevel |= InterestLevel.Display;
break;
case InterestLevel.InterestingParents:
display = true;
break;
default:
display = false;
break;
}
}
int newStackPtr = 0;
for (int i = 0; i < stackPtr; i++)
{
Vertex vertex = vertexStack[i];
if ((vertex.interestLevel & (InterestLevel.Display|InterestLevel.Interesting)) != InterestLevel.Ignore)
{
vertexStack[newStackPtr++] = vertex;
vertex.interestLevel &= ~InterestLevel.Display;
}
}
return newStackPtr;
}
示例11: BuildHandleAllocationGraph
internal Graph BuildHandleAllocationGraph(FilterForm filterForm)
{
Vertex[] funcVertex = new Vertex[1];
Vertex[] vertexStack = new Vertex[1];
Graph graph = new Graph(this);
graph.graphType = Graph.GraphType.HandleAllocationGraph;
BuildFuncVertices(graph, ref funcVertex, filterForm);
for (int i = 0; i < typeSizeStacktraceToCount.Length; i++)
{
if (typeSizeStacktraceToCount[i] > 0)
{
int[] stacktrace = readNewLog.stacktraceTable.IndexToStacktrace(i);
uint count = (uint)typeSizeStacktraceToCount[i];
BuildHandleAllocationTrace(graph, i, count, funcVertex, ref vertexStack, filterForm);
}
}
foreach (Vertex v in graph.vertices.Values)
v.active = true;
graph.BottomVertex.active = false;
return graph;
}
示例12: BuildModVertices
void BuildModVertices(Graph graph, ref Vertex[] modVertex, FilterForm filterForm)
{
for (int i = 0; i < readNewLog.modBasicName.Length; i++)
{
string basicName = readNewLog.modBasicName[i];
string fullName = readNewLog.modFullName[i];
if (basicName != null && fullName != null)
{
readNewLog.AddFunctionVertex(i, basicName, fullName, graph, ref modVertex, filterForm);
modVertex[i].basicName = basicName;
modVertex[i].basicSignature = fullName;
}
}
}
示例13: BuildFuncVertices
internal void BuildFuncVertices(Graph graph, ref Vertex[] funcVertex, FilterForm filterForm)
{
for (int i = 0; i < readNewLog.funcName.Length; i++)
{
string name = readNewLog.funcName[i];
string signature = readNewLog.funcSignature[i];
if (name == null)
name = string.Format("???? function {0}", i);
if (signature == null)
signature = "( ???????? )";
readNewLog.AddFunctionVertex(i, name, signature, graph, ref funcVertex, filterForm);
}
}
示例14: BuildCallTrace
internal void BuildCallTrace(Graph graph, int stackTraceIndex, Vertex[] funcVertex, ref Vertex[] vertexStack, int count, FilterForm filterForm)
{
int stackPtr = BuildVertexStack(stackTraceIndex, funcVertex, ref vertexStack, 0);
Vertex toVertex = graph.TopVertex;
Vertex fromVertex;
Edge edge;
if (ReadNewLog.InterestingCallStack(vertexStack, stackPtr, filterForm))
{
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((uint)count);
}
}
}
示例15: PaintVertex
void PaintVertex(Vertex v, Graphics g, Brush penBrush, Pen pen)
{
Rectangle r = v.rectangle;
v.selectionRectangle = r;
g.DrawRectangle(pen, r);
if (v.selected)
{
using (SolidBrush selectBrush = new SolidBrush(Color.Aqua))
g.FillRectangle(selectBrush, r);
}
RectangleF stringRect;
int lineCount = 2;
if (v.signature != null)
lineCount = 3;
if (r.Height > fontHeight*lineCount)
stringRect = new RectangleF(r.X,r.Y,r.Width,fontHeight);
else
{
stringRect = new RectangleF(r.X,r.Y+r.Height+3,r.Width,fontHeight);
// for these very narrow rectangle, start the selection rectangle 5 pixels above
// the actual rectangle, so people can hit it more easily. Even though they could click
// on the text below, which not everybody tries...
const int vTolerance = 5;
v.selectionRectangle = new Rectangle(r.X, r.Y - vTolerance, r.Width, vTolerance + r.Height + 3 + fontHeight*lineCount);
}
if (v.weightHistory != null)
{
int alpha = 200;
int previousHeight = r.Height;
for (int i = 0; i < v.weightHistory.Length; i++)
{
alpha = alpha*2/3;
ulong weight = v.weightHistory[i];
int height = (int)((float)r.Height/v.weight*weight);
if (height < previousHeight)
{
Color color = Color.FromArgb(alpha, Color.Red);
using (Brush brush = new SolidBrush(color))
{
g.FillRectangle(brush, r.X, r.Y+height, r.Width, previousHeight - height);
}
}
else
{
Color color = Color.FromArgb(alpha, Color.Green);
using (Brush brush = new SolidBrush(color))
{
g.FillRectangle(brush, r.X, r.Y+previousHeight, r.Width, height - previousHeight);
}
}
previousHeight = height;
}
}
g.DrawString(v.basicName, font, penBrush, stringRect);
stringRect.Y += fontHeight;
if (v.signature != null)
{
g.DrawString(v.basicSignature, font, penBrush, stringRect);
stringRect.Y += fontHeight;
int width = (int)g.MeasureString(v.basicSignature, font).Width;
if (stringRect.Width < width)
v.signatureCurtated = true;
}
g.DrawString(v.weightString, font, penBrush, stringRect);
}