src/hotspot/share/services/memBaseline.hpp
changeset 48873 9536c39ac6de
parent 47553 5d20359dd938
child 48874 f09fdaad7321
equal deleted inserted replaced
48872:c7774afc93e3 48873:9536c39ac6de
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    65   // Summary information
    65   // Summary information
    66   MallocMemorySnapshot   _malloc_memory_snapshot;
    66   MallocMemorySnapshot   _malloc_memory_snapshot;
    67   VirtualMemorySnapshot  _virtual_memory_snapshot;
    67   VirtualMemorySnapshot  _virtual_memory_snapshot;
    68   MetaspaceSnapshot      _metaspace_snapshot;
    68   MetaspaceSnapshot      _metaspace_snapshot;
    69 
    69 
    70   size_t               _class_count;
    70   size_t                 _instance_class_count;
       
    71   size_t                 _array_class_count;
    71 
    72 
    72   // Allocation sites information
    73   // Allocation sites information
    73   // Malloc allocation sites
    74   // Malloc allocation sites
    74   LinkedListImpl<MallocSite>                  _malloc_sites;
    75   LinkedListImpl<MallocSite>                  _malloc_sites;
    75 
    76 
    87 
    88 
    88  public:
    89  public:
    89   // create a memory baseline
    90   // create a memory baseline
    90   MemBaseline():
    91   MemBaseline():
    91     _baseline_type(Not_baselined),
    92     _baseline_type(Not_baselined),
    92     _class_count(0) {
    93     _instance_class_count(0), _array_class_count(0) {
    93   }
    94   }
    94 
    95 
    95   bool baseline(bool summaryOnly = true);
    96   bool baseline(bool summaryOnly = true);
    96 
    97 
    97   BaselineType baseline_type() const { return _baseline_type; }
    98   BaselineType baseline_type() const { return _baseline_type; }
   158   }
   159   }
   159 
   160 
   160 
   161 
   161   size_t class_count() const {
   162   size_t class_count() const {
   162     assert(baseline_type() != Not_baselined, "Not yet baselined");
   163     assert(baseline_type() != Not_baselined, "Not yet baselined");
   163     return _class_count;
   164     return _instance_class_count + _array_class_count;
       
   165   }
       
   166 
       
   167   size_t instance_class_count() const {
       
   168     assert(baseline_type() != Not_baselined, "Not yet baselined");
       
   169     return _instance_class_count;
       
   170   }
       
   171 
       
   172   size_t array_class_count() const {
       
   173     assert(baseline_type() != Not_baselined, "Not yet baselined");
       
   174     return _array_class_count;
   164   }
   175   }
   165 
   176 
   166   size_t thread_count() const {
   177   size_t thread_count() const {
   167     assert(baseline_type() != Not_baselined, "Not yet baselined");
   178     assert(baseline_type() != Not_baselined, "Not yet baselined");
   168     return _malloc_memory_snapshot.thread_count();
   179     return _malloc_memory_snapshot.thread_count();
   170 
   181 
   171   // reset the baseline for reuse
   182   // reset the baseline for reuse
   172   void reset() {
   183   void reset() {
   173     _baseline_type = Not_baselined;
   184     _baseline_type = Not_baselined;
   174     // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over.
   185     // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over.
   175     _class_count  = 0;
   186     _instance_class_count  = 0;
       
   187     _array_class_count = 0;
   176 
   188 
   177     _malloc_sites.clear();
   189     _malloc_sites.clear();
   178     _virtual_memory_sites.clear();
   190     _virtual_memory_sites.clear();
   179     _virtual_memory_allocations.clear();
   191     _virtual_memory_allocations.clear();
   180   }
   192   }