Example #1
0
 public override StackSourceCallStackIndex GetCallerIndex(StackSourceCallStackIndex callStackIndex)
 {
     // a call stack index might be a CLRProfiler call stack index, or it might be CLRProfiler allocation index
     if ((uint)callStackIndex < (uint)m_clrProfiler.StackIdLimit)
     {
         ProfilerStackTraceID index = m_clrProfiler.NextFrame((ProfilerStackTraceID)callStackIndex);
         if (index == ProfilerStackTraceID.Null)
         {
             return(StackSourceCallStackIndex.Invalid);
         }
         var ret = (StackSourceCallStackIndex)index;
         Debug.Assert(ret != callStackIndex);
         return(ret);
     }
     else
     {
         // It is a allocation index, so the frame typeName is the nodeId name (offset by the number of methods)
         ProfilerAllocID allocID = (ProfilerAllocID)((int)callStackIndex - (int)m_clrProfiler.StackIdLimit);
         Debug.Assert(allocID != ProfilerAllocID.Null && allocID < m_clrProfiler.AllocIdLimit);
         ProfilerStackTraceID stackId = m_clrProfiler.GetAllocStack(allocID);
         if (stackId == ProfilerStackTraceID.Null)
         {
             return(StackSourceCallStackIndex.Invalid);
         }
         return((StackSourceCallStackIndex)stackId);
     }
 }
Example #2
0
 public override StackSourceFrameIndex GetFrameIndex(StackSourceCallStackIndex callStackIndex)
 {
     // a call stack index might be a CLRProfiler call stack index, or it might be CLRProfiler allocation index
     if ((uint)callStackIndex < (uint)m_clrProfiler.StackIdLimit)
     {
         var method = m_clrProfiler.Method((ProfilerStackTraceID)callStackIndex);
         return((StackSourceFrameIndex)((int)method.MethodId + StackSourceFrameIndex.Start));
     }
     else
     {
         // It is a allocation index, so the frame typeName is the nodeId name (offset by the number of methods)
         ProfilerAllocID allocID = (ProfilerAllocID)((int)callStackIndex - (int)m_clrProfiler.StackIdLimit);
         Debug.Assert(allocID != ProfilerAllocID.Null && allocID < m_clrProfiler.AllocIdLimit);
         return((StackSourceFrameIndex)((int)m_clrProfiler.MethodIdLimit + (int)m_clrProfiler.GetAllocTypeId(allocID) +
                                        StackSourceFrameIndex.Start));
     }
 }