internal static HeavyProfilerEntry ImportXml(XElement xLog, HeavyProfilerEntry parent) { var result = new HeavyProfilerEntry { Parent = parent, Index = int.Parse(xLog.Attribute("Index").Value), Role = xLog.Attribute("Role").Value, BeforeStart = long.Parse(xLog.Attribute("BeforeStart").Value), Start = long.Parse(xLog.Attribute("Start").Value), End = long.Parse(xLog.Attribute("End").Value), AdditionalData = xLog.Attribute("AdditionalData")?.Value, Depth = parent == null ? 0 : parent.Depth + 1 }; if (xLog.Element("Log") != null) { result.Entries = xLog.Elements("Log").Select(x => ImportXml(x, result)).ToList(); } return(result); }
public static HeavyProfilerEntry Find(string fullIndex) { var array = fullIndex.Split('.').Select(a => int.Parse(a)).ToArray(); HeavyProfilerEntry entry = null; List <HeavyProfilerEntry> currentList = Signum.Utilities.HeavyProfiler.Entries; for (int i = 0; i < array.Length; i++) { int index = array[i]; if (currentList == null || currentList.Count <= index) { throw new InvalidOperationException("The ProfileEntry is not available"); } entry = currentList[index]; currentList = entry.Entries; } return(entry); }
public bool Overlaps(HeavyProfilerEntry e) { return(new Interval <long>(this.BeforeStart, this.EndOrNow) .Overlaps(new Interval <long>(e.BeforeStart, e.EndOrNow))); }
public static void ImportXml(XDocument doc, bool rebaseTime) { var list = doc.Element("Logs").Elements("Log").Select(xLog => HeavyProfilerEntry.ImportXml(xLog, null)).ToList(); ImportEntries(list, rebaseTime); }