gcPolicyCounters.cpp revision 8413:92457dfb91bd
11541Srgrimes/*
21541Srgrimes * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
31541Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41541Srgrimes *
51541Srgrimes * This code is free software; you can redistribute it and/or modify it
61541Srgrimes * under the terms of the GNU General Public License version 2 only, as
71541Srgrimes * published by the Free Software Foundation.
81541Srgrimes *
91541Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101541Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111541Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121541Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131541Srgrimes * accompanied this code).
141541Srgrimes *
151541Srgrimes * You should have received a copy of the GNU General Public License version
161541Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171541Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181541Srgrimes *
191541Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201541Srgrimes * or visit www.oracle.com if you need additional information or have any
211541Srgrimes * questions.
221541Srgrimes *
231541Srgrimes */
241541Srgrimes
251541Srgrimes#include "precompiled.hpp"
261541Srgrimes#include "gc/shared/gcPolicyCounters.hpp"
271541Srgrimes#include "memory/resourceArea.hpp"
281541Srgrimes
291541SrgrimesGCPolicyCounters::GCPolicyCounters(const char* name, int collectors,
301541Srgrimes                                   int generations) {
311541Srgrimes
321541Srgrimes  if (UsePerfData) {
331541Srgrimes    EXCEPTION_MARK;
3421666Swollman    ResourceMark rm;
351541Srgrimes
361541Srgrimes    _name_space = "policy";
372168Spaul
382168Spaul    char* cname = PerfDataManager::counter_name(_name_space, "name");
392168Spaul    PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK);
401541Srgrimes
411541Srgrimes    cname = PerfDataManager::counter_name(_name_space, "collectors");
428876Srgrimes    PerfDataManager::create_constant(SUN_GC, cname,  PerfData::U_None,
431541Srgrimes                                     collectors, CHECK);
441541Srgrimes
451541Srgrimes    cname = PerfDataManager::counter_name(_name_space, "generations");
461541Srgrimes    PerfDataManager::create_constant(SUN_GC, cname,  PerfData::U_None,
471541Srgrimes                                     generations, CHECK);
481541Srgrimes
491541Srgrimes    cname = PerfDataManager::counter_name(_name_space, "maxTenuringThreshold");
501541Srgrimes    PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_None,
511541Srgrimes                                     MaxTenuringThreshold, CHECK);
521541Srgrimes
531541Srgrimes    cname = PerfDataManager::counter_name(_name_space, "tenuringThreshold");
541541Srgrimes    _tenuring_threshold =
551541Srgrimes        PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_None,
561541Srgrimes                                         MaxTenuringThreshold, CHECK);
571541Srgrimes
581541Srgrimes    cname = PerfDataManager::counter_name(_name_space, "desiredSurvivorSize");
591541Srgrimes    _desired_survivor_size =
601541Srgrimes        PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
611541Srgrimes                                         CHECK);
621541Srgrimes  }
631541Srgrimes}
641541Srgrimes