/// <summary> /// Look up a sample by index. /// </summary> /// <param name="sampleIndex">The index of the sample to look up.</param> /// <returns> /// The sample, if it can be found and all sub-sources support indexing; null otherwise. /// </returns> public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { if (m_sampleMap != null) { Debug.Assert((int)sampleIndex >= 0 && (int)sampleIndex < SampleIndexLimit); int source = m_sampleMap.SourceOf(sampleIndex); var offset = m_sampleMap.OffsetOf(source, sampleIndex); return(ConvertSample(m_sources[source + 1].GetSampleByIndex(offset), m_sampleStorage, source + 1)); } else { return(base.GetSampleByIndex(sampleIndex)); } }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { if (m_sample == null) { m_sample = new StackSourceSample(this); } var allocs = m_gcHeap.Allocs; m_sample.SampleIndex = sampleIndex;; m_sample.StackIndex = (StackSourceCallStackIndex)(m_clrProfiler.StackIdLimit + (int)allocs[(int)sampleIndex].AllocId); m_sample.Metric = allocs[(int)sampleIndex].Size; m_sample.TimeRelativeMSec = allocs[(int)sampleIndex].MsecFromStart; return(m_sample); }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { if (m_sample == null) { m_sample = new StackSourceSample(this); } var stackId = (ProfilerStackTraceID)m_calls[(int)sampleIndex]; m_sample.SampleIndex = sampleIndex; // subtract 1 so 0 (clrprofiler Scentinal) becomes CallStackIndex Sentinal m_sample.StackIndex = (StackSourceCallStackIndex)(stackId - 1); var method = m_clrProfiler.Method(stackId); var stats = (MethodStats)method.UserData; m_sample.Metric = (float)(((double)method.size) / stats.count); return(m_sample); }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { var nodeIndex = (NodeIndex)sampleIndex; var node = m_graph.GetNode(nodeIndex, m_nodeStorage); m_sampleStorage.Metric = node.Size; m_sampleStorage.SampleIndex = (StackSourceSampleIndex)node.Index; m_sampleStorage.StackIndex = (StackSourceCallStackIndex)node.Index; if (m_asMemoryGraph != null) { m_sampleStorage.TimeRelativeMSec = m_asMemoryGraph.GetAddress(node.Index); } else { m_sampleStorage.TimeRelativeMSec = 0; } return(m_sampleStorage); }
public override void GetReferences(StackSourceSampleIndex nodeIndex, RefDirection dir, Action <StackSourceSampleIndex> callback) { NodeIndex index = (NodeIndex)nodeIndex; // This is the special node that represents 'orphans'. // TODO we simply give up for now. This is OK because we only use GetRefs in places were we are AUGMENTING // the normal call tree (thus by returning nothing we just get the tree nodes). You an imagine cases where // we really do need to report the correct data. if (index == m_graph.NodeIndexLimit) { return; } if (dir == RefDirection.From) { var node = m_graph.GetNode(index, AllocNodeStorage()); for (var childIndex = node.GetFirstChildIndex(); childIndex != NodeIndex.Invalid; childIndex = node.GetNextChildIndex()) { callback((StackSourceSampleIndex)childIndex); } FreeNodeStorage(node); } else { Debug.Assert(dir == RefDirection.To); // Compute the references if we have not already done so. var refGraph = RefGraph; if (m_refNodeStorage == null) { m_refNodeStorage = m_refGraph.AllocNodeStorage(); } // If this code blows up, it could be because m_refNodeStorage is being reused inappropriately (reentrant) // Just make the storage a local var var node = refGraph.GetNode(index, m_refNodeStorage); for (var childIndex = node.GetFirstChildIndex(); childIndex != NodeIndex.Invalid; childIndex = node.GetNextChildIndex()) { callback((StackSourceSampleIndex)childIndex); } } }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { return(m_samples[(int)sampleIndex]); }
public void RemoveSample(StackSourceSampleIndex index) { m_samples[(int)index] = null; m_sampleRemoved = true; }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) => _samples[(int)sampleIndex];
public LinuxPerfScriptStackSourceSample GetLinuxPerfScriptSampleByIndex(StackSourceSampleIndex sampleIndex) { return(m_LinuxPerfScriptSamples[(int)sampleIndex]); }
public static StackSourceSampleIndex IndexOf(this IndexMap map, int source, StackSourceSampleIndex offset) { return((StackSourceSampleIndex)map.IndexOf(source, (int)offset)); }
public static StackSourceSampleIndex OffsetOf(this IndexMap map, int source, StackSourceSampleIndex aggregate) { return((StackSourceSampleIndex)map.OffsetOf(source, (int)aggregate)); }
public static int SourceOf(this IndexMap map, StackSourceSampleIndex aggregate) { return(map.SourceOf((int)aggregate)); }
public NodeIndex GetNodeIndexForSample(StackSourceSampleIndex sampleIdx) { return((NodeIndex)sampleIdx); }
public override StackSourceSample GetSampleByIndex(StackSourceSampleIndex sampleIndex) { return(this.inner.GetSampleByIndex(sampleIndex)); }
public override void GetReferences(StackSourceSampleIndex nodeIndex, RefDirection direction, Action <StackSourceSampleIndex> callback) { this.inner.GetReferences(nodeIndex, direction, callback); }