コード例 #1
0
 public static RequestStatistics Create(RequestStatisticsType tag, long timeTaken)
 {
     return(new RequestStatistics
     {
         info = RequestStatistics.Info.TimeTaken,
         Tag = tag,
         TimeTaken = timeTaken
     });
 }
コード例 #2
0
 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
     });
 }
コード例 #3
0
 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
     });
 }
コード例 #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));
        }
コード例 #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));
        }
コード例 #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));
        }
コード例 #7
0
 public RequestStatistics End(RequestStatisticsType tag)
 {
     return(this.End(tag, null));
 }