/* * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Native memory tracking level // // The meaning of the different states: // // "unknown": pre-init phase (before parsing NMT arguments) // // "off": after initialization - NMT confirmed off. // - nothing is tracked // - no malloc headers are used // // "summary": after initialization with NativeMemoryTracking=summary - NMT in summary mode // - category summaries per tag are tracked // - thread stacks are tracked // - malloc headers are used // - malloc call site table is allocated and used // // "detail": after initialization with NativeMemoryTracking=detail - NMT in detail mode // - category summaries per tag are tracked // - malloc details per call site are tracked // - virtual memory mapping info is tracked // - thread stacks are tracked // - malloc headers are used // - malloc call site table is allocated and used //
// Number of stack frames to capture. This is a // build time decision. constint NMT_TrackingStackDepth = 4;
// A few common utilities for native memory tracking class NMTUtil : AllStatic { public: // Check if index is a valid MEMFLAGS enum value (including mtNone) staticinlinebool flag_index_is_valid(int index) { return index >= 0 && index < mt_number_of_types;
}
// Check if flag value is a valid MEMFLAGS enum value (including mtNone) staticinlinebool flag_is_valid(MEMFLAGS flag) { constint index = static_cast<int>(flag); return flag_index_is_valid(index);
}
// Map memory type to index staticinlineint flag_to_index(MEMFLAGS flag) {
assert(flag_is_valid(flag), "Invalid flag (%u)", (unsigned)flag); returnstatic_cast<int>(flag);
}
// Map memory type to human readable name staticconstchar* flag_to_name(MEMFLAGS flag) { return _strings[flag_to_index(flag)].human_readable;
}
// Map an index to memory type static MEMFLAGS index_to_flag(int index) {
assert(flag_index_is_valid(index), "Invalid flag index (%d)", index); returnstatic_cast<MEMFLAGS>(index);
}
// Parses the tracking level from a string. Returns NMT_unknown if // string is not a valid level. static NMT_TrackingLevel parse_tracking_level(constchar* s);
// Given a string, return associated flag. mtNone if name is invalid. // String can be either the human readable name or the // stringified enum (with or without leading "mt". In all cases, case is ignored. static MEMFLAGS string_to_flag(constchar* name);
// Returns textual representation of a tracking level. staticconstchar* tracking_level_to_string(NMT_TrackingLevel level);
private: struct S { constchar* enum_s; // e.g. "mtNMT" constchar* human_readable; // e.g. "Native Memory Tracking"
}; static S _strings[mt_number_of_types];
};
#endif// SHARE_SERVICES_NMTCOMMON_HPP
¤ Dauer der Verarbeitung: 0.34 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.