Thu, 21 Aug 2014 16:44:41 +0200
8055098: WB API should be extended to provide information about size and age of object.
Summary: Extend the WhiteBox API to provide information about the size and age of objects. Further add a mechanism to trigger a young GC.
Reviewed-by: tschatzl, sjohanss
Contributed-by: Leonid Mesnik <leonid.mesnik@oracle.com>
tonyp@3114 | 1 | /* |
tonyp@3114 | 2 | * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
tonyp@3114 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
tonyp@3114 | 4 | * |
tonyp@3114 | 5 | * This code is free software; you can redistribute it and/or modify it |
tonyp@3114 | 6 | * under the terms of the GNU General Public License version 2 only, as |
tonyp@3114 | 7 | * published by the Free Software Foundation. |
tonyp@3114 | 8 | * |
tonyp@3114 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
tonyp@3114 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
tonyp@3114 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
tonyp@3114 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
tonyp@3114 | 13 | * accompanied this code). |
tonyp@3114 | 14 | * |
tonyp@3114 | 15 | * You should have received a copy of the GNU General Public License version |
tonyp@3114 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
tonyp@3114 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
tonyp@3114 | 18 | * |
tonyp@3114 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
tonyp@3114 | 20 | * or visit www.oracle.com if you need additional information or have any |
tonyp@3114 | 21 | * questions. |
tonyp@3114 | 22 | * |
tonyp@3114 | 23 | */ |
tonyp@3114 | 24 | |
tonyp@3114 | 25 | #include "precompiled.hpp" |
tonyp@3114 | 26 | #include "gc_implementation/g1/g1ErgoVerbose.hpp" |
tonyp@3114 | 27 | #include "utilities/ostream.hpp" |
tonyp@3114 | 28 | |
tonyp@3114 | 29 | ErgoLevel G1ErgoVerbose::_level; |
tonyp@3114 | 30 | bool G1ErgoVerbose::_enabled[ErgoHeuristicNum]; |
tonyp@3114 | 31 | |
tonyp@3114 | 32 | void G1ErgoVerbose::initialize() { |
tonyp@3114 | 33 | set_level(ErgoLow); |
tonyp@3114 | 34 | set_enabled(false); |
tonyp@3114 | 35 | } |
tonyp@3114 | 36 | |
tonyp@3114 | 37 | void G1ErgoVerbose::set_level(ErgoLevel level) { |
tonyp@3114 | 38 | _level = level; |
tonyp@3114 | 39 | } |
tonyp@3114 | 40 | |
tonyp@3114 | 41 | void G1ErgoVerbose::set_enabled(ErgoHeuristic n, bool enabled) { |
tonyp@3114 | 42 | assert(0 <= n && n < ErgoHeuristicNum, "pre-condition"); |
tonyp@3114 | 43 | _enabled[n] = enabled; |
tonyp@3114 | 44 | } |
tonyp@3114 | 45 | |
tonyp@3114 | 46 | void G1ErgoVerbose::set_enabled(bool enabled) { |
tonyp@3114 | 47 | for (int n = 0; n < ErgoHeuristicNum; n += 1) { |
tonyp@3114 | 48 | set_enabled((ErgoHeuristic) n, enabled); |
tonyp@3114 | 49 | } |
tonyp@3114 | 50 | } |
tonyp@3114 | 51 | |
tonyp@3114 | 52 | const char* G1ErgoVerbose::to_string(int tag) { |
tonyp@3114 | 53 | ErgoHeuristic n = extract_heuristic(tag); |
tonyp@3114 | 54 | switch (n) { |
tonyp@3337 | 55 | case ErgoHeapSizing: return "Heap Sizing"; |
tonyp@3337 | 56 | case ErgoCSetConstruction: return "CSet Construction"; |
tonyp@3337 | 57 | case ErgoConcCycles: return "Concurrent Cycles"; |
tonyp@3337 | 58 | case ErgoMixedGCs: return "Mixed GCs"; |
tonyp@3114 | 59 | default: |
tonyp@3114 | 60 | ShouldNotReachHere(); |
tonyp@3114 | 61 | // Keep the Windows compiler happy |
tonyp@3114 | 62 | return NULL; |
tonyp@3114 | 63 | } |
tonyp@3114 | 64 | } |