aoqi@0: /* aoqi@0: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSETSUMMARY_HPP aoqi@0: #define SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSETSUMMARY_HPP aoqi@0: aoqi@0: #include "utilities/ostream.hpp" aoqi@0: aoqi@0: class G1RemSet; aoqi@0: aoqi@0: // A G1RemSetSummary manages statistical information about the G1RemSet aoqi@0: aoqi@0: class G1RemSetSummary VALUE_OBJ_CLASS_SPEC { aoqi@0: private: aoqi@0: friend class GetRSThreadVTimeClosure; aoqi@0: aoqi@0: G1RemSet* _remset; aoqi@0: aoqi@0: G1RemSet* remset() const { aoqi@0: return _remset; aoqi@0: } aoqi@0: aoqi@0: size_t _num_refined_cards; aoqi@0: size_t _num_processed_buf_mutator; aoqi@0: size_t _num_processed_buf_rs_threads; aoqi@0: aoqi@0: size_t _num_coarsenings; aoqi@0: aoqi@0: double* _rs_threads_vtimes; aoqi@0: size_t _num_vtimes; aoqi@0: aoqi@0: double _sampling_thread_vtime; aoqi@0: aoqi@0: void set_rs_thread_vtime(uint thread, double value); aoqi@0: void set_sampling_thread_vtime(double value) { aoqi@0: _sampling_thread_vtime = value; aoqi@0: } aoqi@0: aoqi@0: void free_and_null() { aoqi@0: if (_rs_threads_vtimes) { aoqi@0: FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes, mtGC); aoqi@0: _rs_threads_vtimes = NULL; aoqi@0: _num_vtimes = 0; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // update this summary with current data from various places aoqi@0: void update(); aoqi@0: aoqi@0: public: aoqi@0: G1RemSetSummary() : _remset(NULL), _num_refined_cards(0), aoqi@0: _num_processed_buf_mutator(0), _num_processed_buf_rs_threads(0), _num_coarsenings(0), aoqi@0: _rs_threads_vtimes(NULL), _num_vtimes(0), _sampling_thread_vtime(0.0f) { aoqi@0: } aoqi@0: aoqi@0: ~G1RemSetSummary() { aoqi@0: free_and_null(); aoqi@0: } aoqi@0: aoqi@0: // set the counters in this summary to the values of the others aoqi@0: void set(G1RemSetSummary* other); aoqi@0: // subtract all counters from the other summary, and set them in the current aoqi@0: void subtract_from(G1RemSetSummary* other); aoqi@0: aoqi@0: // initialize and get the first sampling aoqi@0: void initialize(G1RemSet* remset); aoqi@0: aoqi@0: void print_on(outputStream* out); aoqi@0: aoqi@0: double rs_thread_vtime(uint thread) const; aoqi@0: aoqi@0: double sampling_thread_vtime() const { aoqi@0: return _sampling_thread_vtime; aoqi@0: } aoqi@0: aoqi@0: size_t num_concurrent_refined_cards() const { aoqi@0: return _num_refined_cards; aoqi@0: } aoqi@0: aoqi@0: size_t num_processed_buf_mutator() const { aoqi@0: return _num_processed_buf_mutator; aoqi@0: } aoqi@0: aoqi@0: size_t num_processed_buf_rs_threads() const { aoqi@0: return _num_processed_buf_rs_threads; aoqi@0: } aoqi@0: aoqi@0: size_t num_processed_buf_total() const { aoqi@0: return num_processed_buf_mutator() + num_processed_buf_rs_threads(); aoqi@0: } aoqi@0: aoqi@0: size_t num_coarsenings() const { aoqi@0: return _num_coarsenings; aoqi@0: } aoqi@0: }; aoqi@0: aoqi@0: #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSETSUMMARY_HPP