tonyp@3114: /* tonyp@3114: * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. tonyp@3114: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. tonyp@3114: * tonyp@3114: * This code is free software; you can redistribute it and/or modify it tonyp@3114: * under the terms of the GNU General Public License version 2 only, as tonyp@3114: * published by the Free Software Foundation. tonyp@3114: * tonyp@3114: * This code is distributed in the hope that it will be useful, but WITHOUT tonyp@3114: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or tonyp@3114: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License tonyp@3114: * version 2 for more details (a copy is included in the LICENSE file that tonyp@3114: * accompanied this code). tonyp@3114: * tonyp@3114: * You should have received a copy of the GNU General Public License version tonyp@3114: * 2 along with this work; if not, write to the Free Software Foundation, tonyp@3114: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. tonyp@3114: * tonyp@3114: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA tonyp@3114: * or visit www.oracle.com if you need additional information or have any tonyp@3114: * questions. tonyp@3114: * tonyp@3114: */ tonyp@3114: tonyp@3114: #include "precompiled.hpp" tonyp@3114: #include "gc_implementation/g1/g1ErgoVerbose.hpp" tonyp@3114: #include "utilities/ostream.hpp" tonyp@3114: tonyp@3114: ErgoLevel G1ErgoVerbose::_level; tonyp@3114: bool G1ErgoVerbose::_enabled[ErgoHeuristicNum]; tonyp@3114: tonyp@3114: void G1ErgoVerbose::initialize() { tonyp@3114: set_level(ErgoLow); tonyp@3114: set_enabled(false); tonyp@3114: } tonyp@3114: tonyp@3114: void G1ErgoVerbose::set_level(ErgoLevel level) { tonyp@3114: _level = level; tonyp@3114: } tonyp@3114: tonyp@3114: void G1ErgoVerbose::set_enabled(ErgoHeuristic n, bool enabled) { tonyp@3114: assert(0 <= n && n < ErgoHeuristicNum, "pre-condition"); tonyp@3114: _enabled[n] = enabled; tonyp@3114: } tonyp@3114: tonyp@3114: void G1ErgoVerbose::set_enabled(bool enabled) { tonyp@3114: for (int n = 0; n < ErgoHeuristicNum; n += 1) { tonyp@3114: set_enabled((ErgoHeuristic) n, enabled); tonyp@3114: } tonyp@3114: } tonyp@3114: tonyp@3114: const char* G1ErgoVerbose::to_string(int tag) { tonyp@3114: ErgoHeuristic n = extract_heuristic(tag); tonyp@3114: switch (n) { tonyp@3337: case ErgoHeapSizing: return "Heap Sizing"; tonyp@3337: case ErgoCSetConstruction: return "CSet Construction"; tonyp@3337: case ErgoConcCycles: return "Concurrent Cycles"; tonyp@3337: case ErgoMixedGCs: return "Mixed GCs"; tonyp@3114: default: tonyp@3114: ShouldNotReachHere(); tonyp@3114: // Keep the Windows compiler happy tonyp@3114: return NULL; tonyp@3114: } tonyp@3114: }