Path: blob/master/src/hotspot/os/linux/osContainer_linux.hpp
40951 views
/*1* Copyright (c) 2017, 2020, 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_OSCONTAINER_LINUX_HPP25#define OS_LINUX_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 memory limit and _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 memory_limit_in_bytes();49static jlong memory_and_swap_limit_in_bytes();50static jlong memory_soft_limit_in_bytes();51static jlong memory_usage_in_bytes();52static jlong memory_max_usage_in_bytes();5354static int active_processor_count();5556static char * cpu_cpuset_cpus();57static char * cpu_cpuset_memory_nodes();5859static int cpu_quota();60static int cpu_period();6162static int cpu_shares();6364};6566inline bool OSContainer::is_containerized() {67return _is_containerized;68}6970#endif // OS_LINUX_OSCONTAINER_LINUX_HPP717273