public TraceCodeAddress GetManagedMethodOnStack(SampledProfileTraceData se) { TraceCodeAddress ca = TraceLogExtensions.IntructionPointerCodeAddress(se); if (ManagedModulePaths.Contains(ca.ModuleFilePath)) { return(ca); } // We don't have a managed method, so walk to the managed method by skipping calls // inside clr or clrjit TraceCallStack cs = TraceLogExtensions.CallStack(se); while (cs != null) { ca = cs.CodeAddress; if (ca == null) { return(null); } if (ManagedModulePaths.Contains(ca.ModuleFilePath)) { return(ca); } // This is to ensure we calculate time spent in the JIT helpers, for example. cs = ca.ModuleName.IndexOf("clr", StringComparison.OrdinalIgnoreCase) >= 0 || ca.ModuleName.IndexOf("clrjit", StringComparison.OrdinalIgnoreCase) >= 0 ? cs.Caller : null; } return(null); }
private string GetSampledMethodName(JitCapCollector collector, SampledProfileTraceData data) { TraceCodeAddress ca = collector.GetManagedMethodOnStack(data); if (ca == null) { return(null); } if (String.IsNullOrEmpty(ca.ModuleName)) { return(null); } // Lookup symbols, if not already looked up. if (!SymbolsLookedUp.Contains(ca.ModuleName)) { try { collector.EtlDataFile.SetFilterProcess(data.ProcessID); collector.EtlDataFile.LookupSymbolsForModule(ca.ModuleName); } catch (Exception) { return(null); } SymbolsLookedUp.Add(ca.ModuleName); } if (ca.Method == null) { SymbolsMissing.Add(ca.ModuleName); return(null); } return(ca.ModuleName + "!" + ca.Method.FullMethodName); }