src/hotspot/share/services/memTracker.cpp
author zgu
Tue, 31 Jul 2018 07:35:16 -0400
changeset 51264 cf34c71ca27c
parent 50965 29eaf3feab30
child 51308 acf02a6f369e
permissions -rw-r--r--
8208499: NMT: Missing memory tag for Safepoint polling page Summary: Added missing memory tag and cleanup memory type enum Reviewed-by: shade, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     1
/*
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47914
diff changeset
     2
 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     4
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     7
 * published by the Free Software Foundation.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     8
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    13
 * accompanied this code).
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    14
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    18
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    21
 * questions.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    22
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    23
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    24
#include "precompiled.hpp"
47765
b7c7428eaab9 8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents: 47216
diff changeset
    25
#include "jvm.h"
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    26
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    27
#include "runtime/mutex.hpp"
50429
83aec1d357d4 8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents: 49980
diff changeset
    28
#include "runtime/orderAccess.hpp"
47914
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
    29
#include "runtime/vmThread.hpp"
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
    30
#include "runtime/vm_operations.hpp"
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    31
#include "services/memBaseline.hpp"
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    32
#include "services/memReporter.hpp"
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    33
#include "services/mallocTracker.inline.hpp"
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    34
#include "services/memTracker.hpp"
51264
cf34c71ca27c 8208499: NMT: Missing memory tag for Safepoint polling page
zgu
parents: 50965
diff changeset
    35
#include "utilities/debug.hpp"
17838
89e464689cb1 8011064: Some tests have failed with SIGSEGV on arm-hflt on build b82
jprovino
parents: 17074
diff changeset
    36
#include "utilities/defaultStream.hpp"
47914
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
    37
#include "utilities/vmError.hpp"
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    38
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    39
#ifdef SOLARIS
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    40
  volatile bool NMT_stack_walkable = false;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    41
#else
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    42
  volatile bool NMT_stack_walkable = true;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    43
#endif
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    44
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    45
volatile NMT_TrackingLevel MemTracker::_tracking_level = NMT_unknown;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    46
NMT_TrackingLevel MemTracker::_cmdline_tracking_level = NMT_unknown;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    47
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    48
MemBaseline MemTracker::_baseline;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    49
Mutex*      MemTracker::_query_lock = NULL;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    50
bool MemTracker::_is_nmt_env_valid = true;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    51
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    52
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    53
NMT_TrackingLevel MemTracker::init_tracking_level() {
51264
cf34c71ca27c 8208499: NMT: Missing memory tag for Safepoint polling page
zgu
parents: 50965
diff changeset
    54
  // Memory type is encoded into tracking header as a byte field,
cf34c71ca27c 8208499: NMT: Missing memory tag for Safepoint polling page
zgu
parents: 50965
diff changeset
    55
  // make sure that we don't overflow it.
cf34c71ca27c 8208499: NMT: Missing memory tag for Safepoint polling page
zgu
parents: 50965
diff changeset
    56
  STATIC_ASSERT(mt_number_of_types <= max_jubyte);
cf34c71ca27c 8208499: NMT: Missing memory tag for Safepoint polling page
zgu
parents: 50965
diff changeset
    57
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    58
  NMT_TrackingLevel level = NMT_off;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    59
  char buf[64];
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    60
  jio_snprintf(buf, sizeof(buf), "NMT_LEVEL_%d", os::current_process_id());
30125
8ba6e8e367e9 8074895: os::getenv is inadequate
jmanson
parents: 29574
diff changeset
    61
  const char *nmt_option = ::getenv(buf);
8ba6e8e367e9 8074895: os::getenv is inadequate
jmanson
parents: 29574
diff changeset
    62
  if (nmt_option != NULL) {
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    63
    if (strcmp(nmt_option, "summary") == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    64
      level = NMT_summary;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    65
    } else if (strcmp(nmt_option, "detail") == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    66
      level = NMT_detail;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    67
    } else if (strcmp(nmt_option, "off") != 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    68
      // The option value is invalid
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    69
      _is_nmt_env_valid = false;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    70
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    71
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    72
    // Remove the environment variable to avoid leaking to child processes
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    73
    os::unsetenv(buf);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    74
  }
13301
f6dd749390dd 7181986: NMT ON: Assertion failure when running jdi ExpiredRequestDeletionTest
zgu
parents: 13195
diff changeset
    75
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    76
  if (!MallocTracker::initialize(level) ||
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    77
      !VirtualMemoryTracker::initialize(level)) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    78
    level = NMT_off;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    79
  }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    80
  return level;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    81
}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    82
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    83
void MemTracker::init() {
26136
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    84
  NMT_TrackingLevel level = tracking_level();
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    85
  if (level >= NMT_summary) {
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    86
    if (!VirtualMemoryTracker::late_initialize(level)) {
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    87
      shutdown();
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    88
      return;
254c226e4402 8054368: nsk/jdi/VirtualMachine/exit/exit002 crash with detail tracking on (NMT2)
zgu
parents: 25946
diff changeset
    89
    }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    90
    _query_lock = new (std::nothrow) Mutex(Monitor::max_nonleaf, "NMT_queryLock");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    91
    // Already OOM. It is unlikely, but still have to handle it.
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    92
    if (_query_lock == NULL) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    93
      shutdown();
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    94
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    95
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    96
}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    97
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    98
bool MemTracker::check_launcher_nmt_support(const char* value) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
    99
  if (strcmp(value, "=detail") == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   100
    if (MemTracker::tracking_level() != NMT_detail) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   101
      return false;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   102
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   103
  } else if (strcmp(value, "=summary") == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   104
    if (MemTracker::tracking_level() != NMT_summary) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   105
      return false;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   106
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   107
  } else if (strcmp(value, "=off") == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   108
    if (MemTracker::tracking_level() != NMT_off) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   109
      return false;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   110
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   111
  } else {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   112
    _is_nmt_env_valid = false;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   113
  }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   114
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   115
  return true;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   116
}
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   117
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   118
bool MemTracker::verify_nmt_option() {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   119
  return _is_nmt_env_valid;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   120
}
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   121
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   122
void* MemTracker::malloc_base(void* memblock) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   123
  return MallocTracker::get_base(memblock);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   124
}
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   125
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   126
void Tracker::record(address addr, size_t size) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   127
  if (MemTracker::tracking_level() < NMT_summary) return;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   128
  switch(_type) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   129
    case uncommit:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   130
      VirtualMemoryTracker::remove_uncommitted_region(addr, size);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   131
      break;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   132
    case release:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   133
      VirtualMemoryTracker::remove_released_region(addr, size);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   134
        break;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   135
    default:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   136
      ShouldNotReachHere();
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   137
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   138
}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   139
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   140
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   141
// Shutdown can only be issued via JCmd, and NMT JCmd is serialized by lock
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   142
void MemTracker::shutdown() {
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   143
  // We can only shutdown NMT to minimal tracking level if it is ever on.
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   144
  if (tracking_level () > NMT_minimal) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   145
    transition_to(NMT_minimal);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   146
  }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   147
}
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   148
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   149
bool MemTracker::transition_to(NMT_TrackingLevel level) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   150
  NMT_TrackingLevel current_level = tracking_level();
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   151
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   152
  assert(level != NMT_off || current_level == NMT_off, "Cannot transition NMT to off");
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   153
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   154
  if (current_level == level) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   155
    return true;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   156
  } else if (current_level > level) {
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   157
    // Downgrade tracking level, we want to lower the tracking level first
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   158
    _tracking_level = level;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   159
    // Make _tracking_level visible immediately.
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   160
    OrderAccess::fence();
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   161
    VirtualMemoryTracker::transition(current_level, level);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   162
    MallocTracker::transition(current_level, level);
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   163
  } else {
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   164
    // Upgrading tracking level is not supported and has never been supported.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   165
    // Allocating and deallocating malloc tracking structures is not thread safe and
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   166
    // leads to inconsistencies unless a lot coarser locks are added.
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   167
  }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   168
  return true;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   169
}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   170
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   171
void MemTracker::report(bool summary_only, outputStream* output) {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   172
 assert(output != NULL, "No output stream");
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   173
  MemBaseline baseline;
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   174
  if (baseline.baseline(summary_only)) {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   175
    if (summary_only) {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   176
      MemSummaryReporter rpt(baseline, output);
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   177
      rpt.report();
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   178
    } else {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   179
      MemDetailReporter rpt(baseline, output);
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   180
      rpt.report();
49980
57dd7b4ba338 8201572: Improve Metaspace Statistics
stuefe
parents: 49480
diff changeset
   181
      output->print("Metaspace:");
47914
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
   182
      // Metadata reporting requires a safepoint, so avoid it if VM is not in good state.
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
   183
      assert(!VMError::fatal_error_in_progress(), "Do not report metadata in error report");
49980
57dd7b4ba338 8201572: Improve Metaspace Statistics
stuefe
parents: 49480
diff changeset
   184
      VM_PrintMetadata vmop(output, K,
57dd7b4ba338 8201572: Improve Metaspace Statistics
stuefe
parents: 49480
diff changeset
   185
          MetaspaceUtils::rf_show_loaders |
57dd7b4ba338 8201572: Improve Metaspace Statistics
stuefe
parents: 49480
diff changeset
   186
          MetaspaceUtils::rf_break_down_by_spacetype);
47914
564882d918d4 8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
zgu
parents: 47765
diff changeset
   187
      VMThread::execute(&vmop);
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents: 26145
diff changeset
   188
    }
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   189
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   190
}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   191
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   192
// This is a walker to gather malloc site hashtable statistics,
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   193
// the result is used for tuning.
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   194
class StatisticsWalker : public MallocSiteWalker {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   195
 private:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   196
  enum Threshold {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   197
    // aggregates statistics over this threshold into one
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   198
    // line item.
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   199
    report_threshold = 20
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   200
  };
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   201
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   202
 private:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   203
  // Number of allocation sites that have all memory freed
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   204
  int   _empty_entries;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   205
  // Total number of allocation sites, include empty sites
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   206
  int   _total_entries;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   207
  // Number of captured call stack distribution
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   208
  int   _stack_depth_distribution[NMT_TrackingStackDepth];
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   209
  // Hash distribution
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   210
  int   _hash_distribution[report_threshold];
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   211
  // Number of hash buckets that have entries over the threshold
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   212
  int   _bucket_over_threshold;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   213
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   214
  // The hash bucket that walker is currently walking
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   215
  int   _current_hash_bucket;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   216
  // The length of current hash bucket
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   217
  int   _current_bucket_length;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   218
  // Number of hash buckets that are not empty
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   219
  int   _used_buckets;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   220
  // Longest hash bucket length
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   221
  int   _longest_bucket_length;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   222
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   223
 public:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   224
  StatisticsWalker() : _empty_entries(0), _total_entries(0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   225
    int index = 0;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   226
    for (index = 0; index < NMT_TrackingStackDepth; index ++) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   227
      _stack_depth_distribution[index] = 0;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   228
    }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   229
    for (index = 0; index < report_threshold; index ++) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   230
      _hash_distribution[index] = 0;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   231
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   232
    _bucket_over_threshold = 0;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   233
    _longest_bucket_length = 0;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   234
    _current_hash_bucket = -1;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   235
    _current_bucket_length = 0;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   236
    _used_buckets = 0;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   237
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   238
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   239
  virtual bool do_malloc_site(const MallocSite* e) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   240
    if (e->size() == 0) _empty_entries ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   241
    _total_entries ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   242
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   243
    // stack depth distrubution
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   244
    int frames = e->call_stack()->frames();
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   245
    _stack_depth_distribution[frames - 1] ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   246
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   247
    // hash distribution
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   248
    int hash_bucket = e->hash() % MallocSiteTable::hash_buckets();
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   249
    if (_current_hash_bucket == -1) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   250
      _current_hash_bucket = hash_bucket;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   251
      _current_bucket_length = 1;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   252
    } else if (_current_hash_bucket == hash_bucket) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   253
      _current_bucket_length ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   254
    } else {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   255
      record_bucket_length(_current_bucket_length);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   256
      _current_hash_bucket = hash_bucket;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   257
      _current_bucket_length = 1;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   258
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   259
    return true;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   260
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   261
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   262
  // walk completed
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   263
  void completed() {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   264
    record_bucket_length(_current_bucket_length);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   265
  }
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   266
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   267
  void report_statistics(outputStream* out) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   268
    int index;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   269
    out->print_cr("Malloc allocation site table:");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   270
    out->print_cr("\tTotal entries: %d", _total_entries);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   271
    out->print_cr("\tEmpty entries: %d (%2.2f%%)", _empty_entries, ((float)_empty_entries * 100) / _total_entries);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   272
    out->print_cr(" ");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   273
    out->print_cr("Hash distribution:");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   274
    if (_used_buckets < MallocSiteTable::hash_buckets()) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   275
      out->print_cr("empty bucket: %d", (MallocSiteTable::hash_buckets() - _used_buckets));
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   276
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   277
    for (index = 0; index < report_threshold; index ++) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   278
      if (_hash_distribution[index] != 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   279
        if (index == 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   280
          out->print_cr("  %d    entry: %d", 1, _hash_distribution[0]);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   281
        } else if (index < 9) { // single digit
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   282
          out->print_cr("  %d  entries: %d", (index + 1), _hash_distribution[index]);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   283
        } else {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   284
          out->print_cr(" %d entries: %d", (index + 1), _hash_distribution[index]);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   285
        }
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   286
      }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   287
    }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   288
    if (_bucket_over_threshold > 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   289
      out->print_cr(" >%d entries: %d", report_threshold,  _bucket_over_threshold);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   290
    }
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   291
    out->print_cr("most entries: %d", _longest_bucket_length);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   292
    out->print_cr(" ");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   293
    out->print_cr("Call stack depth distribution:");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   294
    for (index = 0; index < NMT_TrackingStackDepth; index ++) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   295
      if (_stack_depth_distribution[index] > 0) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   296
        out->print_cr("\t%d: %d", index + 1, _stack_depth_distribution[index]);
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   297
      }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   298
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   299
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   300
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   301
 private:
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   302
  void record_bucket_length(int length) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   303
    _used_buckets ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   304
    if (length <= report_threshold) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   305
      _hash_distribution[length - 1] ++;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   306
    } else {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   307
      _bucket_over_threshold ++;
13300
38485c548c9f 7182543: NMT ON: Aggregate a few NMT related bugs
zgu
parents: 13195
diff changeset
   308
    }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   309
    _longest_bucket_length = MAX2(_longest_bucket_length, length);
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   310
  }
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   311
};
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   312
18086
f44cf213a775 8013651: NMT: reserve/release sequence id's in incorrect order due to race
zgu
parents: 17838
diff changeset
   313
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   314
void MemTracker::tuning_statistics(outputStream* out) {
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   315
  // NMT statistics
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   316
  StatisticsWalker walker;
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   317
  MallocSiteTable::walk_malloc_site(&walker);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   318
  walker.completed();
18086
f44cf213a775 8013651: NMT: reserve/release sequence id's in incorrect order due to race
zgu
parents: 17838
diff changeset
   319
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   320
  out->print_cr("Native Memory Tracking Statistics:");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   321
  out->print_cr("Malloc allocation site table size: %d", MallocSiteTable::hash_buckets());
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   322
  out->print_cr("             Tracking stack depth: %d", NMT_TrackingStackDepth);
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   323
  NOT_PRODUCT(out->print_cr("Peak concurrent access: %d", MallocSiteTable::access_peak_count());)
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   324
  out->print_cr(" ");
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 25351
diff changeset
   325
  walker.report_statistics(out);
18086
f44cf213a775 8013651: NMT: reserve/release sequence id's in incorrect order due to race
zgu
parents: 17838
diff changeset
   326
}