Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/linux/vm/osContainer_linux.hpp
32285 views
/*1* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef OS_LINUX_VM_OSCONTAINER_LINUX_HPP25#define OS_LINUX_VM_OSCONTAINER_LINUX_HPP2627#include "utilities/globalDefinitions.hpp"28#include "utilities/macros.hpp"29#include "memory/allocation.hpp"3031#define OSCONTAINER_ERROR (-2)3233// 20ms timeout between re-reads of _active_processor_count.34#define OSCONTAINER_CACHE_TIMEOUT (NANOSECS_PER_SEC/50)3536class OSContainer: AllStatic {3738private:39static bool _is_initialized;40static bool _is_containerized;41static int _active_processor_count;4243public:44static void init();45static inline bool is_containerized();46static const char * container_type();4748static jlong uses_mem_hierarchy();49static jlong memory_limit_in_bytes();50static jlong memory_and_swap_limit_in_bytes();51static jlong memory_soft_limit_in_bytes();52static jlong memory_usage_in_bytes();53static jlong memory_max_usage_in_bytes();5455static int active_processor_count();5657static char * cpu_cpuset_cpus();58static char * cpu_cpuset_memory_nodes();5960static int cpu_quota();61static int cpu_period();6263static int cpu_shares();6465};6667inline bool OSContainer::is_containerized() {68assert(_is_initialized, "OSContainer not initialized");69return _is_containerized;70}7172#endif // OS_LINUX_VM_OSCONTAINER_LINUX_HPP737475