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