protected IPerfCounterSet BuildFromXml(XmlElement root) { PerfCounterSet pcs = new PerfCounterSet(); pcs.AutoLogStatistics = true; if (root.HasAttribute("Name")) { pcs.Name = root.GetAttribute("Name"); } if (root.HasAttribute("Debug")) { pcs.Debug = "true".Equals(root.GetAttribute("Debug")); } foreach (XmlNode n in root.ChildNodes) { XmlElement el = n as XmlElement; if (el != null) { PerfCounterBase pcb = LoadFromXml(el); if (pcb.Name == null) { throw new Exception("Missing perf counter name: " + el.OuterXml); } pcs.AddCounter(pcb); } } return(pcs); }
static DefaultCounters() { PerfCounterSet pcs = new PerfCounterSet { Name = "Global", AutoLogStatistics = true }; pcs.AddCounter(new PercentileCalculator { MatchMessageRE = new Regex("STAT.*"), ExtractValueRE = new Regex(""), Name = "ALL" }); _pcs = pcs; }
protected IPerfCounterSet BuildFromXml(XmlElement root) { PerfCounterSet pcs = new PerfCounterSet(); pcs.AutoLogStatistics = true; if (root.HasAttribute("Name")) pcs.Name = root.GetAttribute("Name"); if (root.HasAttribute("Debug")) pcs.Debug = "true".Equals(root.GetAttribute("Debug")); foreach (XmlNode n in root.ChildNodes) { XmlElement el = n as XmlElement; if (el != null) { PerfCounterBase pcb = LoadFromXml(el); if (pcb.Name == null) throw new Exception("Missing perf counter name: " + el.OuterXml); pcs.AddCounter(pcb); } } return pcs; }