Example #1
0
        private string FormatMessage(long extraSleepTime, IDictionary <string, JvmPauseMonitor.GcTimes
                                                                       > gcTimesAfterSleep, IDictionary <string, JvmPauseMonitor.GcTimes> gcTimesBeforeSleep
                                     )
        {
            ICollection <string> gcBeanNames = Sets.Intersection(gcTimesAfterSleep.Keys, gcTimesBeforeSleep
                                                                 .Keys);
            IList <string> gcDiffs = Lists.NewArrayList();

            foreach (string name in gcBeanNames)
            {
                JvmPauseMonitor.GcTimes diff = gcTimesAfterSleep[name].Subtract(gcTimesBeforeSleep
                                                                                [name]);
                if (diff.gcCount != 0)
                {
                    gcDiffs.AddItem("GC pool '" + name + "' had collection(s): " + diff.ToString());
                }
            }
            string ret = "Detected pause in JVM or host machine (eg GC): " + "pause of approximately "
                         + extraSleepTime + "ms\n";

            if (gcDiffs.IsEmpty())
            {
                ret += "No GCs detected";
            }
            else
            {
                ret += Joiner.On("\n").Join(gcDiffs);
            }
            return(ret);
        }
Example #2
0
 private JvmPauseMonitor.GcTimes Subtract(JvmPauseMonitor.GcTimes other)
 {
     return(new JvmPauseMonitor.GcTimes(this.gcCount - other.gcCount, this.gcTimeMillis
                                        - other.gcTimeMillis));
 }