hotspot/src/share/vm/gc/g1/g1ErgoVerbose.cpp
author tschatzl
Wed, 25 Nov 2015 14:43:29 +0100
changeset 34300 6075c1e0e913
parent 34298 f3c9dcc5af96
permissions -rw-r--r--
8136679: JFR event for adaptive IHOP Reviewed-by: tbenson, mgerdin, sangheki, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 11249
diff changeset
     2
 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     4
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     8
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    13
 * accompanied this code).
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    14
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    18
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    21
 * questions.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    22
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    23
 */
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    24
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 11249
diff changeset
    26
#include "gc/g1/g1ErgoVerbose.hpp"
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    27
#include "utilities/ostream.hpp"
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    28
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    29
ErgoLevel G1ErgoVerbose::_level;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    30
bool G1ErgoVerbose::_enabled[ErgoHeuristicNum];
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    31
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    32
void G1ErgoVerbose::initialize() {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    33
  set_level(ErgoLow);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    34
  set_enabled(false);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    35
}
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    36
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    37
void G1ErgoVerbose::set_level(ErgoLevel level) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    38
  _level = level;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    39
}
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    40
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    41
void G1ErgoVerbose::set_enabled(ErgoHeuristic n, bool enabled) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    42
  assert(0 <= n && n < ErgoHeuristicNum, "pre-condition");
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    43
  _enabled[n] = enabled;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    44
}
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    45
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    46
void G1ErgoVerbose::set_enabled(bool enabled) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    47
  for (int n = 0; n < ErgoHeuristicNum; n += 1) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    48
    set_enabled((ErgoHeuristic) n, enabled);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    49
  }
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    50
}
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    51
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    52
const char* G1ErgoVerbose::to_string(int tag) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    53
  ErgoHeuristic n = extract_heuristic(tag);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    54
  switch (n) {
11249
b0c1cc35cafe 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 10523
diff changeset
    55
  case ErgoHeapSizing:        return "Heap Sizing";
b0c1cc35cafe 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 10523
diff changeset
    56
  case ErgoCSetConstruction:  return "CSet Construction";
b0c1cc35cafe 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 10523
diff changeset
    57
  case ErgoConcCycles:        return "Concurrent Cycles";
b0c1cc35cafe 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 10523
diff changeset
    58
  case ErgoMixedGCs:          return "Mixed GCs";
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 30764
diff changeset
    59
  case ErgoTiming:            return "Timing";
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 33204
diff changeset
    60
  case ErgoIHOP:              return "IHOP";
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    61
  default:
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    62
    ShouldNotReachHere();
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    63
    // Keep the Windows compiler happy
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    64
    return NULL;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    65
  }
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    66
}