| 1 | /* | 
|---|
| 2 | * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. | 
|---|
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 
|---|
| 4 | * | 
|---|
| 5 | * This code is free software; you can redistribute it and/or modify it | 
|---|
| 6 | * under the terms of the GNU General Public License version 2 only, as | 
|---|
| 7 | * published by the Free Software Foundation. | 
|---|
| 8 | * | 
|---|
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT | 
|---|
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|---|
| 11 | * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
|---|
| 12 | * version 2 for more details (a copy is included in the LICENSE file that | 
|---|
| 13 | * accompanied this code). | 
|---|
| 14 | * | 
|---|
| 15 | * You should have received a copy of the GNU General Public License version | 
|---|
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, | 
|---|
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 
|---|
| 18 | * | 
|---|
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | 
|---|
| 20 | * or visit www.oracle.com if you need additional information or have any | 
|---|
| 21 | * questions. | 
|---|
| 22 | * | 
|---|
| 23 | */ | 
|---|
| 24 |  | 
|---|
| 25 | #ifndef SHARE_GC_G1_G1REMSETSUMMARY_HPP | 
|---|
| 26 | #define SHARE_GC_G1_G1REMSETSUMMARY_HPP | 
|---|
| 27 |  | 
|---|
| 28 | #include "utilities/globalDefinitions.hpp" | 
|---|
| 29 | #include "utilities/ostream.hpp" | 
|---|
| 30 |  | 
|---|
| 31 | class G1RemSet; | 
|---|
| 32 |  | 
|---|
| 33 | // A G1RemSetSummary manages statistical information about the G1RemSet | 
|---|
| 34 |  | 
|---|
| 35 | class G1RemSetSummary { | 
|---|
| 36 | private: | 
|---|
| 37 | friend class GetRSThreadVTimeClosure; | 
|---|
| 38 |  | 
|---|
| 39 | G1RemSet* _rem_set; | 
|---|
| 40 |  | 
|---|
| 41 | size_t _num_conc_refined_cards; | 
|---|
| 42 | size_t _num_processed_buf_mutator; | 
|---|
| 43 | size_t _num_processed_buf_rs_threads; | 
|---|
| 44 |  | 
|---|
| 45 | size_t _num_coarsenings; | 
|---|
| 46 |  | 
|---|
| 47 | size_t _num_vtimes; | 
|---|
| 48 | double* _rs_threads_vtimes; | 
|---|
| 49 |  | 
|---|
| 50 | double _sampling_thread_vtime; | 
|---|
| 51 |  | 
|---|
| 52 | void set_rs_thread_vtime(uint thread, double value); | 
|---|
| 53 | void set_sampling_thread_vtime(double value) { | 
|---|
| 54 | _sampling_thread_vtime = value; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | // update this summary with current data from various places | 
|---|
| 58 | void update(); | 
|---|
| 59 |  | 
|---|
| 60 | public: | 
|---|
| 61 | G1RemSetSummary(); | 
|---|
| 62 | G1RemSetSummary(G1RemSet* remset); | 
|---|
| 63 |  | 
|---|
| 64 | ~G1RemSetSummary(); | 
|---|
| 65 |  | 
|---|
| 66 | // set the counters in this summary to the values of the others | 
|---|
| 67 | void set(G1RemSetSummary* other); | 
|---|
| 68 | // subtract all counters from the other summary, and set them in the current | 
|---|
| 69 | void subtract_from(G1RemSetSummary* other); | 
|---|
| 70 |  | 
|---|
| 71 | void print_on(outputStream* out); | 
|---|
| 72 |  | 
|---|
| 73 | double rs_thread_vtime(uint thread) const; | 
|---|
| 74 |  | 
|---|
| 75 | double sampling_thread_vtime() const { | 
|---|
| 76 | return _sampling_thread_vtime; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | size_t num_conc_refined_cards() const { | 
|---|
| 80 | return _num_conc_refined_cards; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | size_t num_processed_buf_mutator() const { | 
|---|
| 84 | return _num_processed_buf_mutator; | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 | size_t num_processed_buf_rs_threads() const { | 
|---|
| 88 | return _num_processed_buf_rs_threads; | 
|---|
| 89 | } | 
|---|
| 90 |  | 
|---|
| 91 | size_t num_processed_buf_total() const { | 
|---|
| 92 | return num_processed_buf_mutator() + num_processed_buf_rs_threads(); | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | size_t num_coarsenings() const { | 
|---|
| 96 | return _num_coarsenings; | 
|---|
| 97 | } | 
|---|
| 98 | }; | 
|---|
| 99 |  | 
|---|
| 100 | #endif // SHARE_GC_G1_G1REMSETSUMMARY_HPP | 
|---|
| 101 |  | 
|---|