private static PerfHistory GetHistory(string counterName, string groupName, string instanceName) { PerfHistory rslt; string counter = PerfHistory.GetKey(counterName, groupName, instanceName); if (!History.TryGetValue(counter, out rslt)) { rslt = new PerfHistory(); rslt.CounterName = counterName; rslt.Category = groupName; rslt.InstanceName = instanceName; History.Add(counter, rslt); } return(rslt); }
public static void SetCustomCounter(string counter, long rawValue) { if (!m_Sampling) { return; } string key = PerfHistory.GetKey(counter, "Wisp", ""); PerfHistory ph = null; lock (m_SyncRoot) { if (!History.TryGetValue(key, out ph)) { Log1.Logger("Performance").Debug("Tried set raw value for counter [" + counter + "] but that counter doesn't exist."); return; } ph.Counter.RawValue = rawValue; } }
public static void IncrementCustomCounter(string counter, long amount) { if (!m_Sampling) { return; } PerfHistory ph = null; lock (m_SyncRoot) { if (!History.TryGetValue(PerfHistory.GetKey(counter, "Wisp", ""), out ph)) { Log1.Logger("Performance").Debug("Tried incremented counter [" + counter + "] but that counter doesn't exist."); return; } if (ph.Counter != null) { ph.Counter.IncrementBy(amount); } } }