test/hotspot/jtreg/gc/logging/TestPrintReferences.java
changeset 50395 41258f041b24
parent 50049 9d17c375dc30
child 50605 7f63c74f0974
equal deleted inserted replaced
50394:89dc31d7572b 50395:41258f041b24
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   175 
   175 
   176   // Find the first concurrent Reference Processing log and compare phase time vs. sum of sub-phases.
   176   // Find the first concurrent Reference Processing log and compare phase time vs. sum of sub-phases.
   177   public static void checkLogValue(OutputAnalyzer out) {
   177   public static void checkLogValue(OutputAnalyzer out) {
   178     output = out.getStdout();
   178     output = out.getStdout();
   179 
   179 
       
   180     String patternString = gcLogTimeRegex + indent(0) +
       
   181                            referenceProcessing + ": " + "[0-9]+[.,][0-9]+";
       
   182     Matcher m = Pattern.compile(patternString).matcher(output);
       
   183     if (m.find()) {
       
   184         int start = m.start();
       
   185         int end = output.length();
       
   186         // If there's another concurrent Reference Processing log, ignore it.
       
   187         if (m.find()) {
       
   188             end = m.start();
       
   189         }
       
   190         if (start != -1) {
       
   191             output = output.substring(start, end);
       
   192             checkTrimmedLogValue();
       
   193         }
       
   194      }
       
   195   }
       
   196 
       
   197   public static void checkTrimmedLogValue() {
   180     BigDecimal refProcTime = getTimeValue(referenceProcessing, 0);
   198     BigDecimal refProcTime = getTimeValue(referenceProcessing, 0);
   181 
   199 
   182     BigDecimal sumOfSubPhasesTime = checkPhaseTime(softReference);
   200     BigDecimal sumOfSubPhasesTime = checkPhaseTime(softReference);
   183     sumOfSubPhasesTime = sumOfSubPhasesTime.add(checkPhaseTime(weakReference));
   201     sumOfSubPhasesTime = sumOfSubPhasesTime.add(checkPhaseTime(weakReference));
   184     sumOfSubPhasesTime = sumOfSubPhasesTime.add(checkPhaseTime(finalReference));
   202     sumOfSubPhasesTime = sumOfSubPhasesTime.add(checkPhaseTime(finalReference));