public List <StackTraceTS> StackTrace(string fullIndex) { ProfilerPermission.ViewHeavyProfiler.AssertAuthorized(); var e = HeavyProfiler.Find(fullIndex); if (e == null || e.StackTrace == null) { return(null); } return((from i in 0.To(e.StackTrace.FrameCount) let sf = e.StackTrace.GetFrame(i) let mi = sf.GetMethod() let t = mi.DeclaringType select new StackTraceTS { Namespace = t?.Namespace, Type = t?.TypeName(), Color = t == null ? null : ColorExtensions.ToHtmlColor(t.Assembly.FullName.GetHashCode()), Method = mi.Name, FileName = sf.GetFileName(), LineNumber = sf.GetFileLineNumber(), }).ToList()); }
public ActionResult HeavyRoute(string indices) { ProfilerPermission.ViewHeavyProfiler.AssertAuthorized(); var entry = HeavyProfiler.Find(indices); ViewData[ViewDataKeys.Title] = "Entry " + entry.FullIndex(); return(View(ProfilerClient.ViewPrefix.FormatWith("HeavyDetails"), entry)); }
public List <HeavyProfofilerEntryTS> Details(string fullIndex) { ProfilerPermission.ViewHeavyProfiler.AssertAuthorized(); var entry = HeavyProfiler.Find(fullIndex); var result = new List <HeavyProfofilerEntryTS>(); var now = PerfCounter.Ticks; HeavyProfofilerEntryTS.Fill(result, entry, 0, now); return(result); }
public HttpResponseMessage Download(string indices = null) { XDocument doc = indices == null? HeavyProfiler.ExportXml() : HeavyProfiler.Find(indices).ExportXmlDocument(); using (MemoryStream ms = new MemoryStream()) { doc.Save(ms); string fileName = "Profile-{0}.xml".FormatWith(DateTime.Now.ToString("o").Replace(":", ".")); return(FilesController.GetHttpReponseMessage(new MemoryStream(ms.ToArray()), fileName)); } }
public FileResult DownloadFile(string indices) { XDocument doc = indices == null? HeavyProfiler.ExportXml() : HeavyProfiler.Find(indices).ExportXmlDocument(); using (MemoryStream ms = new MemoryStream()) { HeavyProfiler.ExportXml().Save(ms); string fileName = "Profile-{0}.xml".FormatWith(DateTime.Now.ToString("o").Replace(":", ".")); //Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); return(File(ms.ToArray(), "text/xml", fileName)); } }
public List <StackTraceTS>?StackTrace(string fullIndex) { ProfilerPermission.ViewHeavyProfiler.AssertAuthorized(); var e = HeavyProfiler.Find(fullIndex); if (e == null) { return(null); } if (e.ExternalStackTrace != null) { return((from est in e.ExternalStackTrace select new StackTraceTS { Method = est.MethodName, Color = est.Namespace == null ? null : ColorExtensions.ToHtmlColor(est.Namespace.Split('.').Take(2).ToString(".").GetHashCode()), Type = est.Type, Namespace = est.Namespace !, FileName = est.FileName, LineNumber = est.LineNumber ?? 0 }).ToList());