< prev index next >

src/hotspot/share/gc/g1/g1HRPrinter.hpp

Print this page




  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_VM_GC_G1_G1HRPRINTER_HPP
  26 #define SHARE_VM_GC_G1_G1HRPRINTER_HPP
  27 
  28 #include "gc/g1/heapRegion.hpp"
  29 #include "logging/log.hpp"
  30 #include "memory/allocation.hpp"
  31 
  32 #define SKIP_RETIRED_FULL_REGIONS 1
  33 
  34 class G1HRPrinter VALUE_OBJ_CLASS_SPEC {
  35 
  36 private:
  37 
  38   // Print an action event.
  39   static void print(const char* action, HeapRegion* hr) {
  40     log_trace(gc, region)("G1HR %s(%s) [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]",
  41                           action, hr->get_type_str(), p2i(hr->bottom()), p2i(hr->top()), p2i(hr->end()));
  42   }
  43 
  44 public:
  45   // In some places we iterate over a list in order to generate output
  46   // for the list's elements. By exposing this we can avoid this
  47   // iteration if the printer is not active.
  48   const bool is_active() { return log_is_enabled(Trace, gc, region); }
  49 
  50   // The methods below are convenient wrappers for the print() method.
  51 
  52   void alloc(HeapRegion* hr, bool force = false) {
  53     if (is_active()) {
  54       print((force) ? "ALLOC-FORCE" : "ALLOC", hr);




  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_VM_GC_G1_G1HRPRINTER_HPP
  26 #define SHARE_VM_GC_G1_G1HRPRINTER_HPP
  27 
  28 #include "gc/g1/heapRegion.hpp"
  29 #include "logging/log.hpp"

  30 
  31 #define SKIP_RETIRED_FULL_REGIONS 1
  32 
  33 class G1HRPrinter {
  34 
  35 private:
  36 
  37   // Print an action event.
  38   static void print(const char* action, HeapRegion* hr) {
  39     log_trace(gc, region)("G1HR %s(%s) [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]",
  40                           action, hr->get_type_str(), p2i(hr->bottom()), p2i(hr->top()), p2i(hr->end()));
  41   }
  42 
  43 public:
  44   // In some places we iterate over a list in order to generate output
  45   // for the list's elements. By exposing this we can avoid this
  46   // iteration if the printer is not active.
  47   const bool is_active() { return log_is_enabled(Trace, gc, region); }
  48 
  49   // The methods below are convenient wrappers for the print() method.
  50 
  51   void alloc(HeapRegion* hr, bool force = false) {
  52     if (is_active()) {
  53       print((force) ? "ALLOC-FORCE" : "ALLOC", hr);


< prev index next >