public Stats() { Requests = new RequestStats(); }
private void StatsTimer_Tick(object sender, EventArgs e) { RequestStats?.Invoke(this, EventArgs.Empty); }
public void BeginRequest() { long requestID; lock (COUNT_LOCK) { requestID = _requestCount++; } Thread requestThread = Thread.CurrentThread; RequestStats stats = new RequestStats(); stats.StartTimeMillis = DateTimeUtil.GetCurrentUtcTimeMillis(); stats.RequestThread = Thread.CurrentThread; stats.RequestID = requestID; lock (_pendingRequests) { _pendingRequests[stats.RequestThread] = stats; } }
private void DumpStats(RequestStats stats, StringBuilder builder, long currentTime) { builder.AppendLine("**Request #" + stats.RequestID + " pending for " + (currentTime - stats.StartTimeMillis) + " millis."); StackTrace stackTrace = GetStackTrace(stats.RequestThread); if (stackTrace == null) { builder.AppendLine(" <stack trace unavailable>"); } else { builder.AppendLine(stackTrace.ToString()); } }
private void Tick(object source) { RequestStats?.Invoke(this, EventArgs.Empty); }