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_SERVICES_NMT_COMMON_HPP
26 #define SHARE_VM_SERVICES_NMT_COMMON_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 #define CALC_OBJ_SIZE_IN_TYPE(obj, type) (align_size_up_(sizeof(obj), sizeof(type))/sizeof(type))
32
33 // Native memory tracking level
34 enum NMT_TrackingLevel {
35 NMT_unknown = 0xFF,
36 NMT_off = 0x00,
37 NMT_minimal = 0x01,
38 NMT_summary = 0x02,
39 NMT_detail = 0x03
40 };
41
42 // Number of stack frames to capture. This is a
43 // build time decision.
44 const int NMT_TrackingStackDepth = 4;
45
46 // A few common utilities for native memory tracking
47 class NMTUtil : AllStatic {
48 public:
49 // Map memory type to index
50 static inline int flag_to_index(MEMFLAGS flag) {
51 const int index = flag & 0xff;
|
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_SERVICES_NMT_COMMON_HPP
26 #define SHARE_VM_SERVICES_NMT_COMMON_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 #define CALC_OBJ_SIZE_IN_TYPE(obj, type) (align_up_(sizeof(obj), sizeof(type))/sizeof(type))
32
33 // Native memory tracking level
34 enum NMT_TrackingLevel {
35 NMT_unknown = 0xFF,
36 NMT_off = 0x00,
37 NMT_minimal = 0x01,
38 NMT_summary = 0x02,
39 NMT_detail = 0x03
40 };
41
42 // Number of stack frames to capture. This is a
43 // build time decision.
44 const int NMT_TrackingStackDepth = 4;
45
46 // A few common utilities for native memory tracking
47 class NMTUtil : AllStatic {
48 public:
49 // Map memory type to index
50 static inline int flag_to_index(MEMFLAGS flag) {
51 const int index = flag & 0xff;
|