< prev index next >

src/hotspot/share/runtime/perfMemory.cpp

Print this page




   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 #include "precompiled.hpp"

  26 #include "logging/log.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "prims/jvm.h"
  29 #include "runtime/arguments.hpp"
  30 #include "runtime/java.hpp"
  31 #include "runtime/mutex.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 #include "runtime/orderAccess.inline.hpp"
  34 #include "runtime/os.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "runtime/perfMemory.hpp"
  37 #include "runtime/safepoint.hpp"
  38 #include "runtime/statSampler.hpp"
  39 #include "utilities/align.hpp"
  40 #include "utilities/globalDefinitions.hpp"
  41 
  42 // Prefix of performance data file.
  43 const char               PERFDATA_NAME[] = "hsperfdata";
  44 
  45 // Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating
  46 // character will be included in the sizeof(PERFDATA_NAME) operation.
  47 static const size_t PERFDATA_FILENAME_LEN = sizeof(PERFDATA_NAME) +
  48                                             UINT_CHARS + 1;
  49 
  50 char*                    PerfMemory::_start = NULL;
  51 char*                    PerfMemory::_end = NULL;
  52 char*                    PerfMemory::_top = NULL;
  53 size_t                   PerfMemory::_capacity = 0;
  54 jint                     PerfMemory::_initialized = false;
  55 PerfDataPrologue*        PerfMemory::_prologue = NULL;
  56 bool                     PerfMemory::_destroyed = false;
  57 
  58 void perfMemory_init() {
  59 
  60   if (!UsePerfData) return;
  61 
  62   PerfMemory::initialize();
  63 }
  64 
  65 void perfMemory_exit() {
  66 
  67   if (!UsePerfData) return;
  68   if (!PerfMemory::is_usable()) return;
  69 
  70   // Only destroy PerfData objects if we're at a safepoint and the
  71   // StatSampler is not active. Otherwise, we risk removing PerfData
  72   // objects that are currently being used by running JavaThreads
  73   // or the StatSampler. This method is invoked while we are not at
  74   // a safepoint during a VM abort so leaving the PerfData objects




   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 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "logging/log.hpp"
  28 #include "memory/allocation.inline.hpp"

  29 #include "runtime/arguments.hpp"
  30 #include "runtime/java.hpp"
  31 #include "runtime/mutex.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 #include "runtime/orderAccess.inline.hpp"
  34 #include "runtime/os.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "runtime/perfMemory.hpp"
  37 #include "runtime/safepoint.hpp"
  38 #include "runtime/statSampler.hpp"
  39 #include "utilities/align.hpp"
  40 #include "utilities/globalDefinitions.hpp"
  41 
  42 // Prefix of performance data file.
  43 const char               PERFDATA_NAME[] = "hsperfdata";
  44 
  45 // Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating
  46 // character will be included in the sizeof(PERFDATA_NAME) operation.
  47 static const size_t PERFDATA_FILENAME_LEN = sizeof(PERFDATA_NAME) +
  48                                             UINT_CHARS + 1;
  49 
  50 char*                    PerfMemory::_start = NULL;
  51 char*                    PerfMemory::_end = NULL;
  52 char*                    PerfMemory::_top = NULL;
  53 size_t                   PerfMemory::_capacity = 0;
  54 int                      PerfMemory::_initialized = false;
  55 PerfDataPrologue*        PerfMemory::_prologue = NULL;
  56 bool                     PerfMemory::_destroyed = false;
  57 
  58 void perfMemory_init() {
  59 
  60   if (!UsePerfData) return;
  61 
  62   PerfMemory::initialize();
  63 }
  64 
  65 void perfMemory_exit() {
  66 
  67   if (!UsePerfData) return;
  68   if (!PerfMemory::is_usable()) return;
  69 
  70   // Only destroy PerfData objects if we're at a safepoint and the
  71   // StatSampler is not active. Otherwise, we risk removing PerfData
  72   // objects that are currently being used by running JavaThreads
  73   // or the StatSampler. This method is invoked while we are not at
  74   // a safepoint during a VM abort so leaving the PerfData objects


< prev index next >