/* * Copyright (c) 1999, 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. *
*/
// which_logical_cpu=-1 returns accumulated ticks for all cpus. staticbool get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu); staticbool _stack_is_executable; staticvoid *dlopen_helper(constchar *name, char *ebuf, int ebuflen); staticvoid *dll_load_in_vmthread(constchar *name, char *ebuf, int ebuflen); staticconstchar *dll_path(void* lib);
staticvoid init_thread_fpu_state(); staticint get_fpu_control_word(); staticvoid set_fpu_control_word(int fpu_control); static pthread_t main_thread(void) { return _main_thread; } // returns kernel thread id (similar to LWP id on Solaris), which can be // used to access /proc static pid_t gettid();
// Determine if the vmid is the parent pid for a child in a PID namespace. // Return the namespace pid if so, otherwise -1. staticint get_namespace_pid(int vmid);
// Output structure for query_process_memory_info() (all values in KB) struct meminfo_t {
ssize_t vmsize; // current virtual size
ssize_t vmpeak; // peak virtual size
ssize_t vmrss; // current resident set size
ssize_t vmhwm; // peak resident set size
ssize_t vmswap; // swapped out
ssize_t rssanon; // resident set size (anonymous mappings, needs 4.5)
ssize_t rssfile; // resident set size (file mappings, needs 4.5)
ssize_t rssshmem; // resident set size (shared mappings, needs 4.5)
};
// Attempts to query memory information about the current process and return it in the output structure. // May fail (returns false) or succeed (returns true) but not all output fields are available; unavailable // fields will contain -1. staticbool query_process_memory_info(meminfo_t* info);
staticvoid numa_interleave_memory(void *start, size_t size) { // Prefer v2 API if (_numa_interleave_memory_v2 != NULL) { if (is_running_in_interleave_mode()) {
_numa_interleave_memory_v2(start, size, _numa_interleave_bitmask);
} elseif (_numa_membind_bitmask != NULL) {
_numa_interleave_memory_v2(start, size, _numa_membind_bitmask);
}
} elseif (_numa_interleave_memory != NULL) {
_numa_interleave_memory(start, size, _numa_all_nodes);
}
} staticvoid numa_set_preferred(int node) { if (_numa_set_preferred != NULL) {
_numa_set_preferred(node);
}
} staticvoid numa_set_bind_policy(int policy) { if (_numa_set_bind_policy != NULL) {
_numa_set_bind_policy(policy);
}
} staticint numa_distance(int node1, int node2) { return _numa_distance != NULL ? _numa_distance(node1, node2) : -1;
} staticlong numa_move_pages(int pid, unsignedlong count, void **pages, constint *nodes, int *status, int flags) { return _numa_move_pages != NULL ? _numa_move_pages(pid, count, pages, nodes, status, flags) : -1;
} staticint get_node_by_cpu(int cpu_id); staticint get_existing_num_nodes(); // Check if numa node is configured (non-zero memory node). staticbool is_node_in_configured_nodes(unsignedint n) { if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) { return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
} else returnfalse;
} // Check if numa node exists in the system (including zero memory nodes). staticbool is_node_in_existing_nodes(unsignedint n) { if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) { return _numa_bitmask_isbitset(_numa_nodes_ptr, n);
} elseif (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) { // Not all libnuma API v2 implement numa_nodes_ptr, so it's not possible // to trust the API version for checking its absence. On the other hand, // numa_nodes_ptr found in libnuma 2.0.9 and above is the only way to get // a complete view of all numa nodes in the system, hence numa_nodes_ptr // is used to handle CPU and nodes on architectures (like PowerPC) where // there can exist nodes with CPUs but no memory or vice-versa and the // nodes may be non-contiguous. For most of the architectures, like // x86_64, numa_node_ptr presents the same node set as found in // numa_all_nodes_ptr so it's possible to use numa_all_nodes_ptr as a // substitute. return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
} else returnfalse;
} // Check if node is in bound node set. staticbool is_node_in_bound_nodes(int node) { if (_numa_bitmask_isbitset != NULL) { if (is_running_in_interleave_mode()) { return _numa_bitmask_isbitset(_numa_interleave_bitmask, node);
} else { return _numa_membind_bitmask != NULL ? _numa_bitmask_isbitset(_numa_membind_bitmask, node) : false;
}
} returnfalse;
} // Check if bound to only one numa node. // Returns true if bound to a single numa node, otherwise returns false. staticbool is_bound_to_single_node() { int nodes = 0; unsignedint node = 0; unsignedint highest_node_number = 0;
#ifdef __GLIBC__ // os::Linux::get_mallinfo() hides the complexity of dealing with mallinfo() or // mallinfo2() from the user. Use this function instead of raw mallinfo/mallinfo2() // to keep the JVM runtime-compatible with different glibc versions. // // mallinfo2() was added with glibc (>2.32). Legacy mallinfo() was deprecated with // 2.33 and may vanish in future glibcs. So we may have both or either one of // them. // // mallinfo2() is functionally equivalent to legacy mallinfo but returns sizes as // 64-bit on 64-bit platforms. Legacy mallinfo uses 32-bit fields. However, legacy // mallinfo is still perfectly fine to use if we know the sizes cannot have wrapped. // For example, if the process virtual size does not exceed 4G, we cannot have // malloc'ed more than 4G, so the results from legacy mallinfo() can still be used. // // os::Linux::get_mallinfo() will always prefer mallinfo2() if found, but will fall back // to legacy mallinfo() if only that is available. In that case, it will return true // in *might_have_wrapped. struct glibc_mallinfo {
size_t arena;
size_t ordblks;
size_t smblks;
size_t hblks;
size_t hblkhd;
size_t usmblks;
size_t fsmblks;
size_t uordblks;
size_t fordblks;
size_t keepcost;
}; staticvoid get_mallinfo(glibc_mallinfo* out, bool* might_have_wrapped); #endif// GLIBC
};
#endif// OS_LINUX_OS_LINUX_HPP
¤ Dauer der Verarbeitung: 0.33 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.