コード例 #1
0
 private Request CreateRequestStats( RequestBegin begin, RequestEnd end)
 {
     List<Method> methods = null;
     if (_currentCallstacks.ContainsKey(end.Thread))
     {
         methods = _currentCallstacks[end.Thread].ToList();
         _currentCallstacks.Remove(end.Thread);
     }
     return new Request(begin.Id,begin.Url,begin.Time,(end.Time - begin.Time).Ticks,methods);
 }
コード例 #2
0
ファイル: TimerModule.cs プロジェクト: Yarosan/HomeAccounting
 private void Context_EndRequest(object sender, EventArgs e)
 {
     if (HttpContext.Current.CurrentNotification == RequestNotification.EndRequest)
     {
         float elapsedTime = (float)_stopwatch.ElapsedTicks / Stopwatch.Frequency;
         _stopwatch.Reset();
         RequestEnd?.Invoke(this, new TimerModuleEventArgs()
         {
             Duration = elapsedTime
         });
     }
 }
コード例 #3
0
 private void OnRequestEnd(RequestEnd args)
 {
     if (_currentRequests.ContainsKey(args.Thread))
     {
         if (_currentRequests[args.Thread].Id == args.Id)
         {
             Logger.Trace("END Request {1}{0}", _currentRequests[args.Thread].Url, args.Thread);
             var request = CreateRequestStats(_currentRequests[args.Thread],args);
             _requestStatsConsumer.Tell(request);
             _currentRequests.Remove(args.Thread);
         }
         else
         {
             Logger.Warn("Current Thread with id = {0} is handling different request. Expected: {1}, actual: {2}", args.Thread.ThreadId, args.Id, _currentRequests[args.Thread].Id);
         }
     }
 }
コード例 #4
0
 public virtual void OnRequestEnd(WebEventArgs e)
 {
     RequestEnd?.Invoke(e.Context, e);
 }
コード例 #5
0
 private void OnRequestEnd(RequestEventArgs e)
 {
     RequestEnd?.Invoke(this, e);
 }