7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 #include "precompiled.hpp"
26 #include "logging/log.hpp"
27 #include "memory/universe.hpp"
28 #include "oops/oop.inline.hpp"
29 #include "runtime/arguments.hpp"
30 #include "runtime/vm_version.hpp"
31
32 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
33 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
34
35 uint64_t Abstract_VM_Version::_features = 0;
36 const char* Abstract_VM_Version::_features_string = "";
37
38 bool Abstract_VM_Version::_supports_cx8 = false;
39 bool Abstract_VM_Version::_supports_atomic_getset4 = false;
40 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
41 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
42 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
43 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
44 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
45
46 #ifndef HOTSPOT_VERSION_STRING
282
283 const char *Abstract_VM_Version::printable_jdk_debug_level() {
284 // Debug level is not printed for "release" builds
285 return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
286 }
287
288 unsigned int Abstract_VM_Version::jvm_version() {
289 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
290 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
291 ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
292 (Abstract_VM_Version::vm_build_number() & 0xFF);
293 }
294
295
296 void VM_Version_init() {
297 VM_Version::initialize();
298
299 if (log_is_enabled(Info, os, cpu)) {
300 char buf[1024];
301 ResourceMark rm;
302 outputStream* log = Log(os, cpu)::info_stream();
303 os::print_cpu_info(log, buf, sizeof(buf));
304 }
305 }
306
307 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
308 unsigned int num,
309 unsigned int den,
310 unsigned int switch_pt) {
311 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
312 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
313 unsigned int threads;
314 // For very large machines, there are diminishing returns
315 // for large numbers of worker threads. Instead of
316 // hogging the whole system, use a fraction of the workers for every
317 // processor after the first 8. For example, on a 72 cpu machine
318 // and a chosen fraction of 5/8
319 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
320 unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
321 threads = (ncpus <= switch_pt) ?
322 ncpus :
323 (switch_pt + ((ncpus - switch_pt) * num) / den);
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 #include "precompiled.hpp"
26 #include "logging/log.hpp"
27 #include "logging/logStream.hpp"
28 #include "memory/universe.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "runtime/arguments.hpp"
31 #include "runtime/vm_version.hpp"
32
33 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
34 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
35
36 uint64_t Abstract_VM_Version::_features = 0;
37 const char* Abstract_VM_Version::_features_string = "";
38
39 bool Abstract_VM_Version::_supports_cx8 = false;
40 bool Abstract_VM_Version::_supports_atomic_getset4 = false;
41 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
42 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
43 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
44 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
45 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
46
47 #ifndef HOTSPOT_VERSION_STRING
283
284 const char *Abstract_VM_Version::printable_jdk_debug_level() {
285 // Debug level is not printed for "release" builds
286 return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
287 }
288
289 unsigned int Abstract_VM_Version::jvm_version() {
290 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
291 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
292 ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
293 (Abstract_VM_Version::vm_build_number() & 0xFF);
294 }
295
296
297 void VM_Version_init() {
298 VM_Version::initialize();
299
300 if (log_is_enabled(Info, os, cpu)) {
301 char buf[1024];
302 ResourceMark rm;
303 LogStream ls(Log(os, cpu)::info());
304 os::print_cpu_info(&ls, buf, sizeof(buf));
305 }
306 }
307
308 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
309 unsigned int num,
310 unsigned int den,
311 unsigned int switch_pt) {
312 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
313 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
314 unsigned int threads;
315 // For very large machines, there are diminishing returns
316 // for large numbers of worker threads. Instead of
317 // hogging the whole system, use a fraction of the workers for every
318 // processor after the first 8. For example, on a 72 cpu machine
319 // and a chosen fraction of 5/8
320 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
321 unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
322 threads = (ncpus <= switch_pt) ?
323 ncpus :
324 (switch_pt + ((ncpus - switch_pt) * num) / den);
|