jmasa@2821: /* mikael@4153: * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. jmasa@2821: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jmasa@2821: * jmasa@2821: * This code is free software; you can redistribute it and/or modify it jmasa@2821: * under the terms of the GNU General Public License version 2 only, as jmasa@2821: * published by the Free Software Foundation. jmasa@2821: * jmasa@2821: * This code is distributed in the hope that it will be useful, but WITHOUT jmasa@2821: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jmasa@2821: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jmasa@2821: * version 2 for more details (a copy is included in the LICENSE file that jmasa@2821: * accompanied this code). jmasa@2821: * jmasa@2821: * You should have received a copy of the GNU General Public License version jmasa@2821: * 2 along with this work; if not, write to the Free Software Foundation, jmasa@2821: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jmasa@2821: * jmasa@2821: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jmasa@2821: * or visit www.oracle.com if you need additional information or have any jmasa@2821: * questions. jmasa@2821: * jmasa@2821: */ jmasa@2821: jmasa@2821: #include "precompiled.hpp" jmasa@2821: #include "gc_implementation/shared/hSpaceCounters.hpp" jmasa@2821: #include "memory/generation.hpp" jmasa@2821: #include "memory/resourceArea.hpp" jmasa@2821: jmasa@2821: HSpaceCounters::HSpaceCounters(const char* name, jmasa@2821: int ordinal, jmasa@2821: size_t max_size, jmasa@2821: size_t initial_capacity, jmasa@2821: GenerationCounters* gc) { jmasa@2821: jmasa@2821: if (UsePerfData) { jmasa@2821: EXCEPTION_MARK; jmasa@2821: ResourceMark rm; jmasa@2821: jmasa@2821: const char* cns = jmasa@2821: PerfDataManager::name_space(gc->name_space(), "space", ordinal); jmasa@2821: zgu@3900: _name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC); jmasa@2821: strcpy(_name_space, cns); jmasa@2821: jmasa@2821: const char* cname = PerfDataManager::counter_name(_name_space, "name"); jmasa@2821: PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK); jmasa@2821: jmasa@2821: cname = PerfDataManager::counter_name(_name_space, "maxCapacity"); jmasa@2821: PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, jmasa@2821: (jlong)max_size, CHECK); jmasa@2821: jmasa@2821: cname = PerfDataManager::counter_name(_name_space, "capacity"); jmasa@2821: _capacity = PerfDataManager::create_variable(SUN_GC, cname, jmasa@2821: PerfData::U_Bytes, jmasa@2821: initial_capacity, CHECK); jmasa@2821: jmasa@2821: cname = PerfDataManager::counter_name(_name_space, "used"); jmasa@2821: _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, jmasa@2821: (jlong) 0, CHECK); jmasa@2821: jmasa@2821: cname = PerfDataManager::counter_name(_name_space, "initCapacity"); jmasa@2821: PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, jmasa@2821: initial_capacity, CHECK); jmasa@2821: } jmasa@2821: }