src/hotspot/share/gc/shared/workerDataArray.cpp
author stefank
Thu, 22 Feb 2018 18:36:07 +0100
changeset 49047 8f004146e407
parent 47216 71c04702a3d5
child 59198 92c98aa0f801
permissions -rw-r--r--
8198515: Extract SoftReferencePolicy code out of CollectorPolicy Reviewed-by: pliden, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     1
/*
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     4
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     7
 * published by the Free Software Foundation.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     8
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    13
 * accompanied this code).
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    14
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    18
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    21
 * questions.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    22
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    23
 */
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    24
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    25
#include "precompiled.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    26
#include "gc/shared/workerDataArray.inline.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    27
#include "utilities/ostream.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    28
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    29
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    30
size_t WorkerDataArray<size_t>::uninitialized() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    31
  return (size_t)-1;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    32
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    33
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    34
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    35
double WorkerDataArray<double>::uninitialized() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    36
  return -1.0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    37
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    38
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    39
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    40
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    41
  out->print(" Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf", min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    42
  if (print_sum) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    43
    out->print(", Sum: %4.1lf", sum * MILLIUNITS);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    44
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    45
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    46
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    47
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    48
void WorkerDataArray<size_t>::WDAPrinter::summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    49
  out->print(" Min: " SIZE_FORMAT ", Avg: %4.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT, min, avg, max, diff);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    50
  if (print_sum) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    51
    out->print(", Sum: " SIZE_FORMAT, sum);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    52
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    53
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    54
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    55
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    56
void WorkerDataArray<double>::WDAPrinter::details(const WorkerDataArray<double>* phase, outputStream* out) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    57
  out->print("%-25s", "");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    58
  for (uint i = 0; i < phase->_length; ++i) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    59
    double value = phase->get(i);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    60
    if (value != phase->uninitialized()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    61
      out->print(" %4.1lf", phase->get(i) * 1000.0);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    62
    } else {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    63
      out->print(" -");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    64
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    65
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    66
  out->cr();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    67
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    68
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    69
template <>
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    70
void WorkerDataArray<size_t>::WDAPrinter::details(const WorkerDataArray<size_t>* phase, outputStream* out) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    71
  out->print("%-25s", "");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    72
  for (uint i = 0; i < phase->_length; ++i) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    73
    size_t value = phase->get(i);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    74
    if (value != phase->uninitialized()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    75
      out->print("  " SIZE_FORMAT, phase->get(i));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    76
    } else {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    77
      out->print(" -");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    78
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    79
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    80
  out->cr();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    81
}