public void EndExecution(IDBProfileExecData data) { TextContextProfileData tcdata = data as TextContextProfileData; tcdata.EndNow(); if (null != this._context) { _context.WriteLine("{0}: Completed in {1}\r\n", _name, tcdata.Duration); } }
// // IDBProfiler Implementation // /// <summary> /// Registers the start of an SQL execution - based on the parameters, and returns the ProfilerExecData to reference and send back to EndExecution /// </summary> /// <param name="connectonName"></param> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> public IDBProfileExecData BeginExecution(string connectonName, string sql, params object[] parameters) { int changelogindex = this._changeIndex; IDBProfileExecData[] all = new IDBProfileExecData[this.Count]; for (int i = 0; i < all.Length; i++) { all[i] = this[i].BeginExecution(connectonName, sql, parameters); } return(new ProfilerExecDataMock(all, changelogindex)); }
/// <summary> /// Registers the end of the execution for a specific execution data - this is the ProfileData returned from the BeginExecution method /// </summary> /// <param name="data">The profile data returned from a BeginExecution method</param> public void EndExecution(IDBProfileExecData data) { if (null == data) { throw new ArgumentNullException("data"); } if (!(data is ProfilerExecData)) { throw new InvalidCastException("data"); } ProfilerExecData execdata = data as ProfilerExecData; execdata.Ended = _running.Elapsed; this.RegisterExecutionComplete(execdata); if (this._collect) { this.UpdateExecutionSummary(execdata); } }
/// <summary> /// Registers the completion of an execution (calling end on each of the contained profilers) /// </summary> /// <param name="data"></param> public void EndExecution(IDBProfileExecData data) { if (!(data is ProfilerExecDataMock)) { throw new InvalidCastException("data"); } ProfilerExecDataMock mock = data as ProfilerExecDataMock; //make sure this collection has not changed since the begin exec call - we'd be in an indeterminate state. if (mock.ChangeIndex != this._changeIndex) { throw new InvalidOperationException(Errors.ProfilerCollectionChangedBetweenStartAndEnd); } for (int i = 0; i < _inneritems.Count; i++) { IDBProfiler prof = _inneritems[i]; IDBProfileExecData innerdata = mock.InnerItems[i]; prof.EndExecution(innerdata); } }