internal static void Register(ChoBaseProfile profile) { if (profile == null || profile.ProfilerName.IsNullOrWhiteSpace()) { return; } if (profile.ProfilerName == ChoProfile.GLOBAL_PROFILE_NAME || profile.ProfilerName == ChoProfile.NULL_PROFILE_NAME) { return; } lock (_profileCacheLock) { if (!_profileCache.ContainsKey(profile.ProfilerName)) { _profileCache.AddOrUpdate(profile.ProfilerName, profile, (k, v) => v); } if (_profileStack == null) { _profileStack = new Stack <ChoBaseProfile>(); } _profileStack.Push(profile); _contextProfile = profile; if (_contextProfile == null) { _contextProfile = ChoProfile.Default; } } }
internal ChoBaseProfile(bool condition, string name, string msg, ChoBaseProfile outerProfile, bool delayedStartProfile, string startActions, string stopActions) { _condition = condition; _name = name; _outerProfile = outerProfile; if (_outerProfile == null) { _profileBackingStore = ChoProfileBackingStoreManager.GetProfileBackingStore(name, startActions, stopActions); } _delayedStartProfile = delayedStartProfile; if (_condition) { if (!msg.IsNullOrEmpty()) { _msg = msg; } else if (!_name.IsNullOrEmpty()) { _msg = String.Format(_msg, _name); } else { _msg = ChoProfile.GetDefaultMsg(ChoStackTrace.GetStackFrame(GetType().Namespace)); } } if (ChoTraceSettings.Me.IndentProfiling) { if (outerProfile != null) { _indent = outerProfile.Indent + 1; } } if (!_delayedStartProfile) { StartIfNotStarted(); } if (_outerProfile is ChoProfileContainer) { ((ChoProfileContainer)_outerProfile).Add(this); } }
internal static void Unregister(ChoBaseProfile profile) { if (profile == null || profile.ProfilerName.IsNullOrWhiteSpace()) { return; } if (profile.ProfilerName == ChoProfile.GLOBAL_PROFILE_NAME || profile.ProfilerName == ChoProfile.NULL_PROFILE_NAME) { return; } lock (_profileCacheLock) { ChoBaseProfile x = null; if (_profileCache.ContainsKey(profile.ProfilerName)) { _profileCache.TryRemove(profile.ProfilerName, out x); } if (_profileStack != null) { if (_profileStack.Count > 0) { _profileStack.Pop(); } if (_profileStack.Count > 0) { _contextProfile = _profileStack.Peek(); } else { _contextProfile = null; } } if (_contextProfile == null) { _contextProfile = ChoProfile.Default; } } }
private ChoBaseProfile(bool condition, string name, string msg, ChoBaseProfile outerProfile) : this(condition, name, msg, outerProfile, false, null, null) { }
public ChoBaseProfile(string msg, ChoBaseProfile outerProfile) : this(_defaultCondition, DEFAULT_NAME, msg, outerProfile) { }
internal ChoStreamProfile(bool condition, string name, string msg, ChoBaseProfile outerProfile, bool delayedStartProfile, string startActions, string stopActions) : base(condition, name, msg, outerProfile, delayedStartProfile, startActions, stopActions) { }
public ChoStreamProfile(string msg, ChoBaseProfile outerProfile) : base(msg, outerProfile) { }
public ChoBufferProfile(string msg, ChoBaseProfile outerProfile) : base(msg, outerProfile) { }