예제 #1
0
            public virtual void Run()
            {
                StopWatch sw = new StopWatch();
                IDictionary <string, JvmPauseMonitor.GcTimes> gcTimesBeforeSleep = this._enclosing
                                                                                   .GetGcTimes();

                while (this._enclosing.shouldRun)
                {
                    sw.Reset().Start();
                    try
                    {
                        Thread.Sleep(JvmPauseMonitor.SleepIntervalMs);
                    }
                    catch (Exception)
                    {
                        return;
                    }
                    long extraSleepTime = sw.Now(TimeUnit.Milliseconds) - JvmPauseMonitor.SleepIntervalMs;
                    IDictionary <string, JvmPauseMonitor.GcTimes> gcTimesAfterSleep = this._enclosing.
                                                                                      GetGcTimes();
                    if (extraSleepTime > this._enclosing.warnThresholdMs)
                    {
                        ++this._enclosing.numGcWarnThresholdExceeded;
                        JvmPauseMonitor.Log.Warn(this._enclosing.FormatMessage(extraSleepTime, gcTimesAfterSleep
                                                                               , gcTimesBeforeSleep));
                    }
                    else
                    {
                        if (extraSleepTime > this._enclosing.infoThresholdMs)
                        {
                            ++this._enclosing.numGcInfoThresholdExceeded;
                            JvmPauseMonitor.Log.Info(this._enclosing.FormatMessage(extraSleepTime, gcTimesAfterSleep
                                                                                   , gcTimesBeforeSleep));
                        }
                    }
                    this._enclosing.totalGcExtraSleepTime += extraSleepTime;
                    gcTimesBeforeSleep = gcTimesAfterSleep;
                }
            }
예제 #2
0
 public virtual void TestStopInTryWithResource()
 {
     using (StopWatch sw = new StopWatch())
     {
     }
 }