コード例 #1
0
 public long StopStopWatch(ContainerWatch cw)
 {
     lock (thisLock) {
         var  result       = cw.StopStopWatch();
         long timeFonction = result.timeFonction;
         //if (timeFonction >= RecordMaxTime) {
         //}
         var exist = listLogGroupCallPerformanceItem.Where(c => c.sender == result.sender).FirstOrDefault();
         if (exist == null)
         {
             exist = new LogGroupCallPerformanceItem()
             {
                 sender = result.sender, CptCall = 0, lastCall = DateTime.MaxValue
             };
             listLogGroupCallPerformanceItem.Add(exist);
         }
         exist.CptCall++;
         DateTime now = DateTime.Now;
         if (exist.lastCall < now)
         {
             var delay = now - exist.lastCall;
             exist.AverageDelaiCall = (long)delay.TotalMilliseconds;
         }
         exist.lastCall = now;
         if (result.timeFonction >= exist.MaxTimeFonction)
         {
             exist.MaxTimeFonction = result.timeFonction;
             exist.lastMaxLogCallPerformanceItem = result;
             exist.WarningTimeMax = exist.MaxTimeFonction > RecordMaxTime;
         }
         exist.AverageTimeFonction += result.timeFonction;
         exist.AverageTimeFonction  = exist.AverageTimeFonction / exist.CptCall;
         //exist.AverageDelaiCall
         //exist.AverageTimeFonction
         return(timeFonction);
     }
 }
コード例 #2
0
        public ContainerWatch StartStopWatch(HttpRequest httpRequest)
        {
            ContainerWatch cw = new ContainerWatch(httpRequest);

            return(cw);
        }