public static Func<TimingLevel, object, IOperationTimer> GetTimer(ILog log) { if (_store != null) return (level, target) => new OperationTimer(level, target, _store); lock (_lockObj) { if (_store == null) { _store = new CommonLogStore(log); } } return (level, target) => new OperationTimer(level, target, _store); }
public OperationTimer(TimingLevel timingLevel, object target, ITimingStore store) { Store = store; if (!Store.Enabled) return; var op = target as IOperation; if (op == null) return; _timingLevel = timingLevel; _type = op.GetType(); _opaque = op.Opaque; _key = op.Key; _stopwatch = Stopwatch.StartNew(); }
public static Func <TimingLevel, object, IOperationTimer> GetTimer(ILog log) { if (_store != null) { return((level, target) => new OperationTimer(level, target, _store)); } lock (_lockObj) { if (_store == null) { _store = new CommonLogStore(log); } } return((level, target) => new OperationTimer(level, target, _store)); }
public OperationTimer(TimingLevel timingLevel, object target, ITimingStore store) { Store = store; if (!Store.Enabled) { return; } var op = target as IOperation; if (op == null) { return; } _timingLevel = timingLevel; _type = op.GetType(); _opaque = op.Opaque; _key = op.Key; _stopwatch = Stopwatch.StartNew(); }
public QueryTimer(IQueryRequest queryRequest, ITimingStore store, bool enableQueryTiming) { Store = store; if (!store.Enabled || !enableQueryTiming) return; if (queryRequest == null) { throw new ArgumentException(QueryMustBeProvided); } if (string.IsNullOrEmpty(queryRequest.GetOriginalStatement())) { throw new ArgumentException(QueryStatementMustBeProvided); } _statement = queryRequest.GetOriginalStatement(); _enableQueryTiming = enableQueryTiming; ClusterElapsedTime = NotRecorded; _stopwatch = Stopwatch.StartNew(); }
public QueryTimer(IQueryRequest queryRequest, ITimingStore store, bool enableQueryTiming) { if (!store.Enabled || !enableQueryTiming) { return; } if (queryRequest == null) { throw new ArgumentException(QueryMustBeProvided); } if (string.IsNullOrEmpty(queryRequest.GetOriginalStatement())) { throw new ArgumentException(QueryStatementMustBeProvided); } Store = store; _contextId = queryRequest.CurrentContextId; _statement = queryRequest.GetOriginalStatement(); ClusterElapsedTime = NotRecorded; _stopwatch = Stopwatch.StartNew(); }