< prev index next >

test/serviceability/tmtools/jstat/utils/JstatResults.java

Print this page




  69 
  70     /**
  71      * Checks if a column with a given name exists
  72      *
  73      * @param name - name of the column
  74      * @return true if the column exist, false otherwise
  75      */
  76     public boolean valueExists(String name) {
  77         return new StringOfValues(getStdoutLine(0)).getIndex(name) != -1;
  78     }
  79 
  80     /**
  81      * Helper function to assert the increase of the GC events between 2
  82      * measurements
  83      *
  84      * @param measurement1 -first measurement
  85      * @param measurement2 -first measurement
  86      */
  87     public static void assertGCEventsIncreased(JstatResults measurement1, JstatResults measurement2) {
  88         assertThat(measurement2.getFloatValue("YGC") > measurement1.getFloatValue("YGC"), "YGC didn't increase between measurements 1 and 2");
  89         assertThat(measurement2.getFloatValue("FGC") > measurement1.getFloatValue("FGC"), "FGC didn't increase between measurements 2 and 3");




  90     }
  91 
  92     /**
  93      * Helper function to assert the increase of the GC time between 2
  94      * measurements
  95      *
  96      * @param measurement1 -first measurement
  97      * @param measurement2 -first measurement
  98      */
  99     public static void assertGCTimeIncreased(JstatResults measurement1, JstatResults measurement2) {
 100         assertThat(measurement2.getFloatValue("YGCT") > measurement1.getFloatValue("YGCT"), "YGCT time didn't increase between measurements 1 and 2");
 101         assertThat(measurement2.getFloatValue("FGCT") > measurement1.getFloatValue("FGCT"), "FGCT time didn't increase between measurements 1 and 2");




 102         assertThat(measurement2.getFloatValue("GCT") > measurement1.getFloatValue("GCT"), "GCT time didn't increase between measurements 1 and 2");
 103     }
 104 
 105     /**
 106      * Helper function to assert the utilization of the space
 107      *
 108      * @param measurement - measurement results to analyze
 109      * @param targetMemoryUsagePercent -assert that not less than this amount of
 110      * space has been utilized
 111      */
 112     public static void assertSpaceUtilization(JstatResults measurement, float targetMemoryUsagePercent) {
 113 
 114         if (measurement.valueExists("OU")) {
 115             float OC = measurement.getFloatValue("OC");
 116             float OU = measurement.getFloatValue("OU");
 117             assertThat((OU / OC) > targetMemoryUsagePercent, "Old space utilization should be > "
 118                     + (targetMemoryUsagePercent * 100) + "%, actually OU / OC = " + (OU / OC));
 119         }
 120 
 121         if (measurement.valueExists("MU")) {




  69 
  70     /**
  71      * Checks if a column with a given name exists
  72      *
  73      * @param name - name of the column
  74      * @return true if the column exist, false otherwise
  75      */
  76     public boolean valueExists(String name) {
  77         return new StringOfValues(getStdoutLine(0)).getIndex(name) != -1;
  78     }
  79 
  80     /**
  81      * Helper function to assert the increase of the GC events between 2
  82      * measurements
  83      *
  84      * @param measurement1 -first measurement
  85      * @param measurement2 -first measurement
  86      */
  87     public static void assertGCEventsIncreased(JstatResults measurement1, JstatResults measurement2) {
  88         assertThat(measurement2.getFloatValue("YGC") > measurement1.getFloatValue("YGC"), "YGC didn't increase between measurements 1 and 2");
  89         boolean increasedFGC =
  90           measurement2.getFloatValue("FGC") > measurement1.getFloatValue("FGC");
  91         boolean increasedCGC =
  92           measurement2.getFloatValue("CGC") > measurement1.getFloatValue("CGC");
  93         assertThat(increasedFGC || increasedCGC, "FGC or CGC didn't increase between measurements 2 and 3");
  94     }
  95 
  96     /**
  97      * Helper function to assert the increase of the GC time between 2
  98      * measurements
  99      *
 100      * @param measurement1 -first measurement
 101      * @param measurement2 -first measurement
 102      */
 103     public static void assertGCTimeIncreased(JstatResults measurement1, JstatResults measurement2) {
 104         assertThat(measurement2.getFloatValue("YGCT") > measurement1.getFloatValue("YGCT"), "YGCT time didn't increase between measurements 1 and 2");
 105         boolean increasedFGCT =
 106         measurement2.getFloatValue("FGCT") > measurement1.getFloatValue("FGCT");
 107         boolean increasedCGCT =
 108         measurement2.getFloatValue("CGCT") > measurement1.getFloatValue("CGCT");
 109         assertThat(increasedFGCT || increasedCGCT, "FGCT or CGCT didn't increase between measurements 2 and 3");
 110         assertThat(measurement2.getFloatValue("GCT") > measurement1.getFloatValue("GCT"), "GCT time didn't increase between measurements 1 and 2");
 111     }
 112 
 113     /**
 114      * Helper function to assert the utilization of the space
 115      *
 116      * @param measurement - measurement results to analyze
 117      * @param targetMemoryUsagePercent -assert that not less than this amount of
 118      * space has been utilized
 119      */
 120     public static void assertSpaceUtilization(JstatResults measurement, float targetMemoryUsagePercent) {
 121 
 122         if (measurement.valueExists("OU")) {
 123             float OC = measurement.getFloatValue("OC");
 124             float OU = measurement.getFloatValue("OU");
 125             assertThat((OU / OC) > targetMemoryUsagePercent, "Old space utilization should be > "
 126                     + (targetMemoryUsagePercent * 100) + "%, actually OU / OC = " + (OU / OC));
 127         }
 128 
 129         if (measurement.valueExists("MU")) {


< prev index next >