@Test public void testExtractXmxValue() { String jc = " -Xmx1024m -verbose:gc -Xloggc:/tmp/@taskid@.gc" ; String valStr = JobHistoryFileParserBase.extractXmxValueStr(jc); String expStr = "1024m"; assertEquals(expStr, valStr); }
static String extractXmxValueStr(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.info("Null/empty input argument to get xmxValue, returning " + Constants.DEFAULT_XMX_SETTING_STR); return Constants.DEFAULT_XMX_SETTING_STR; } final String JAVA_XMX_PREFIX = "-Xmx"; String[] xmxStr = javaChildOptsStr.split(JAVA_XMX_PREFIX); if (xmxStr.length >= 2) { String[] valuesStr = xmxStr[1].split(" "); if (valuesStr.length >= 1) { return valuesStr[0]; } else { LOG.info("Strange Xmx setting, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } else { LOG.info("Xmx setting absent, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } }
JobHistoryFileParserBase implements JobHistoryFileParser { static String extractXmxValueStr(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.info("Null/empty input argument to get xmxValue, returning " + Constants.DEFAULT_XMX_SETTING_STR); return Constants.DEFAULT_XMX_SETTING_STR; } final String JAVA_XMX_PREFIX = "-Xmx"; String[] xmxStr = javaChildOptsStr.split(JAVA_XMX_PREFIX); if (xmxStr.length >= 2) { String[] valuesStr = xmxStr[1].split(" "); if (valuesStr.length >= 1) { return valuesStr[0]; } else { LOG.info("Strange Xmx setting, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } else { LOG.info("Xmx setting absent, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } }
JobHistoryFileParserBase implements JobHistoryFileParser { static String extractXmxValueStr(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.info("Null/empty input argument to get xmxValue, returning " + Constants.DEFAULT_XMX_SETTING_STR); return Constants.DEFAULT_XMX_SETTING_STR; } final String JAVA_XMX_PREFIX = "-Xmx"; String[] xmxStr = javaChildOptsStr.split(JAVA_XMX_PREFIX); if (xmxStr.length >= 2) { String[] valuesStr = xmxStr[1].split(" "); if (valuesStr.length >= 1) { return valuesStr[0]; } else { LOG.info("Strange Xmx setting, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } else { LOG.info("Xmx setting absent, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } protected  JobHistoryFileParserBase(Configuration conf); }
JobHistoryFileParserBase implements JobHistoryFileParser { static String extractXmxValueStr(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.info("Null/empty input argument to get xmxValue, returning " + Constants.DEFAULT_XMX_SETTING_STR); return Constants.DEFAULT_XMX_SETTING_STR; } final String JAVA_XMX_PREFIX = "-Xmx"; String[] xmxStr = javaChildOptsStr.split(JAVA_XMX_PREFIX); if (xmxStr.length >= 2) { String[] valuesStr = xmxStr[1].split(" "); if (valuesStr.length >= 1) { return valuesStr[0]; } else { LOG.info("Strange Xmx setting, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } else { LOG.info("Xmx setting absent, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } protected  JobHistoryFileParserBase(Configuration conf); Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes); static long getXmxValue(String javaChildOptsStr); static long getXmxTotal(final long xmx75); static long getSubmitTimeMillisFromJobHistory(byte[] jobHistoryRaw); static double calculateJobCost(long mbMillis, double computeTco, long machineMemory); }
JobHistoryFileParserBase implements JobHistoryFileParser { static String extractXmxValueStr(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.info("Null/empty input argument to get xmxValue, returning " + Constants.DEFAULT_XMX_SETTING_STR); return Constants.DEFAULT_XMX_SETTING_STR; } final String JAVA_XMX_PREFIX = "-Xmx"; String[] xmxStr = javaChildOptsStr.split(JAVA_XMX_PREFIX); if (xmxStr.length >= 2) { String[] valuesStr = xmxStr[1].split(" "); if (valuesStr.length >= 1) { return valuesStr[0]; } else { LOG.info("Strange Xmx setting, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } else { LOG.info("Xmx setting absent, returning default " + javaChildOptsStr); return Constants.DEFAULT_XMX_SETTING_STR; } } protected  JobHistoryFileParserBase(Configuration conf); Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes); static long getXmxValue(String javaChildOptsStr); static long getXmxTotal(final long xmx75); static long getSubmitTimeMillisFromJobHistory(byte[] jobHistoryRaw); static double calculateJobCost(long mbMillis, double computeTco, long machineMemory);  }