public static RequestStatistics Create(RequestStatisticsType tag, long timeTaken)
 {
     return(new RequestStatistics
     {
         info = RequestStatistics.Info.TimeTaken,
         Tag = tag,
         TimeTaken = timeTaken
     });
 }
 public static RequestStatistics Create(RequestStatisticsType tag, long timeTaken, int requestCount)
 {
     return(new RequestStatistics
     {
         info = (RequestStatistics.Info.TimeTaken | RequestStatistics.Info.RequestCount),
         Tag = tag,
         TimeTaken = timeTaken,
         RequestCount = requestCount
     });
 }
 public static RequestStatistics Create(RequestStatisticsType tag, long timeTaken, string destination)
 {
     return(new RequestStatistics
     {
         info = (RequestStatistics.Info.TimeTaken | RequestStatistics.Info.Destination),
         Tag = tag,
         TimeTaken = timeTaken,
         Destination = destination
     });
 }
Exemple #4
0
        public RequestStatistics End(RequestStatisticsType tag, string destination)
        {
            ThreadTimes fromCurrentThread = ThreadTimes.GetFromCurrentThread();

            if (this.begin == null || fromCurrentThread == null)
            {
                return(null);
            }
            long timeTaken = (long)(fromCurrentThread.Kernel.TotalMilliseconds - this.begin.Kernel.TotalMilliseconds) + (long)(fromCurrentThread.User.TotalMilliseconds - this.begin.User.TotalMilliseconds);

            if (destination == null)
            {
                return(RequestStatistics.Create(tag, timeTaken));
            }
            return(RequestStatistics.Create(tag, timeTaken, destination));
        }
Exemple #5
0
        public RequestStatistics End(RequestStatisticsType tag, string destination)
        {
            long timeTaken    = 0L;
            int  requestCount = 0;
            PerformanceContext performanceContext;

            if (NativeMethods.GetTLSPerformanceContext(out performanceContext))
            {
                timeTaken    = (long)((performanceContext.rpcLatency - this.beginRpcLatency) / 100000UL);
                requestCount = (int)(performanceContext.rpcCount - this.beginRpcCount);
            }
            if (destination == null)
            {
                return(RequestStatistics.Create(tag, timeTaken, requestCount));
            }
            return(RequestStatistics.Create(tag, timeTaken, requestCount, destination));
        }
Exemple #6
0
        public RequestStatistics End(RequestStatisticsType tag, string destination)
        {
            PerformanceContext performanceContext = PerformanceContext.Current;
            long timeTaken    = 0L;
            int  requestCount = 0;

            if (this.begin != null && performanceContext != null)
            {
                timeTaken    = (long)(performanceContext.RequestLatency - this.begin.RequestLatency);
                requestCount = (int)(performanceContext.RequestCount - this.begin.RequestCount);
            }
            if (destination == null)
            {
                return(RequestStatistics.Create(tag, timeTaken, requestCount));
            }
            return(RequestStatistics.Create(tag, timeTaken, requestCount, destination));
        }
Exemple #7
0
 public RequestStatistics End(RequestStatisticsType tag)
 {
     return(this.End(tag, null));
 }