src/share/vm/gc_implementation/shared/hSpaceCounters.cpp

Thu, 19 Jun 2014 13:31:14 +0200

author
brutisso
date
Thu, 19 Jun 2014 13:31:14 +0200
changeset 6904
0982ec23da03
parent 4153
b9a9ed0f8eeb
child 6876
710a3c8b516e
permissions
-rw-r--r--

8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
Reviewed-by: jwilhelm, ehelin, tschatzl

jmasa@2821 1 /*
mikael@4153 2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
jmasa@2821 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jmasa@2821 4 *
jmasa@2821 5 * This code is free software; you can redistribute it and/or modify it
jmasa@2821 6 * under the terms of the GNU General Public License version 2 only, as
jmasa@2821 7 * published by the Free Software Foundation.
jmasa@2821 8 *
jmasa@2821 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jmasa@2821 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jmasa@2821 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jmasa@2821 12 * version 2 for more details (a copy is included in the LICENSE file that
jmasa@2821 13 * accompanied this code).
jmasa@2821 14 *
jmasa@2821 15 * You should have received a copy of the GNU General Public License version
jmasa@2821 16 * 2 along with this work; if not, write to the Free Software Foundation,
jmasa@2821 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jmasa@2821 18 *
jmasa@2821 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jmasa@2821 20 * or visit www.oracle.com if you need additional information or have any
jmasa@2821 21 * questions.
jmasa@2821 22 *
jmasa@2821 23 */
jmasa@2821 24
jmasa@2821 25 #include "precompiled.hpp"
jmasa@2821 26 #include "gc_implementation/shared/hSpaceCounters.hpp"
jmasa@2821 27 #include "memory/generation.hpp"
jmasa@2821 28 #include "memory/resourceArea.hpp"
jmasa@2821 29
jmasa@2821 30 HSpaceCounters::HSpaceCounters(const char* name,
jmasa@2821 31 int ordinal,
jmasa@2821 32 size_t max_size,
jmasa@2821 33 size_t initial_capacity,
jmasa@2821 34 GenerationCounters* gc) {
jmasa@2821 35
jmasa@2821 36 if (UsePerfData) {
jmasa@2821 37 EXCEPTION_MARK;
jmasa@2821 38 ResourceMark rm;
jmasa@2821 39
jmasa@2821 40 const char* cns =
jmasa@2821 41 PerfDataManager::name_space(gc->name_space(), "space", ordinal);
jmasa@2821 42
zgu@3900 43 _name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
jmasa@2821 44 strcpy(_name_space, cns);
jmasa@2821 45
jmasa@2821 46 const char* cname = PerfDataManager::counter_name(_name_space, "name");
jmasa@2821 47 PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK);
jmasa@2821 48
jmasa@2821 49 cname = PerfDataManager::counter_name(_name_space, "maxCapacity");
jmasa@2821 50 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
jmasa@2821 51 (jlong)max_size, CHECK);
jmasa@2821 52
jmasa@2821 53 cname = PerfDataManager::counter_name(_name_space, "capacity");
jmasa@2821 54 _capacity = PerfDataManager::create_variable(SUN_GC, cname,
jmasa@2821 55 PerfData::U_Bytes,
jmasa@2821 56 initial_capacity, CHECK);
jmasa@2821 57
jmasa@2821 58 cname = PerfDataManager::counter_name(_name_space, "used");
jmasa@2821 59 _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
jmasa@2821 60 (jlong) 0, CHECK);
jmasa@2821 61
jmasa@2821 62 cname = PerfDataManager::counter_name(_name_space, "initCapacity");
jmasa@2821 63 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
jmasa@2821 64 initial_capacity, CHECK);
jmasa@2821 65 }
jmasa@2821 66 }

mercurial