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

Thu, 20 Sep 2012 09:52:56 -0700

author
johnc
date
Thu, 20 Sep 2012 09:52:56 -0700
changeset 4067
b2ef234911c9
parent 3900
d2a62e0f25eb
child 4153
b9a9ed0f8eeb
permissions
-rw-r--r--

7190666: G1: assert(_unused == 0) failed: Inconsistency in PLAB stats
Summary: Reset the fields in ParGCAllocBuffer, that are used for accumulating values for the ResizePLAB sensors in PLABStats, to zero after flushing the values to the PLABStats fields. Flush PLABStats values only when retiring the final allocation buffers prior to disposing of a G1ParScanThreadState object, rather than when retiring every allocation buffer.
Reviewed-by: jwilhelm, jmasa, ysr

jmasa@2821 1 /*
jmasa@2821 2 * Copyright (c) 2011, 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