Mercurial > hg > truffle
comparison src/os/linux/vm/os_linux.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | cefad50507d8 e4f478e7781b |
children | d8041d695d19 |
comparison
equal
deleted
inserted
replaced
12782:92b7ec34ddfa | 13086:096c224171c4 |
---|---|
1331 | 1331 |
1332 // Time since start-up in seconds to a fine granularity. | 1332 // Time since start-up in seconds to a fine granularity. |
1333 // Used by VMSelfDestructTimer and the MemProfiler. | 1333 // Used by VMSelfDestructTimer and the MemProfiler. |
1334 double os::elapsedTime() { | 1334 double os::elapsedTime() { |
1335 | 1335 |
1336 return (double)(os::elapsed_counter()) * 0.000001; | 1336 return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution |
1337 } | 1337 } |
1338 | 1338 |
1339 jlong os::elapsed_counter() { | 1339 jlong os::elapsed_counter() { |
1340 timeval time; | 1340 return javaTimeNanos() - initial_time_count; |
1341 int status = gettimeofday(&time, NULL); | |
1342 return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count; | |
1343 } | 1341 } |
1344 | 1342 |
1345 jlong os::elapsed_frequency() { | 1343 jlong os::elapsed_frequency() { |
1346 return (1000 * 1000); | 1344 return NANOSECS_PER_SEC; // nanosecond resolution |
1347 } | 1345 } |
1348 | 1346 |
1349 bool os::supports_vtime() { return true; } | 1347 bool os::supports_vtime() { return true; } |
1350 bool os::enable_vtime() { return false; } | 1348 bool os::enable_vtime() { return false; } |
1351 bool os::vtime_enabled() { return false; } | 1349 bool os::vtime_enabled() { return false; } |
3359 | 3357 |
3360 bool os::Linux::setup_large_page_type(size_t page_size) { | 3358 bool os::Linux::setup_large_page_type(size_t page_size) { |
3361 if (FLAG_IS_DEFAULT(UseHugeTLBFS) && | 3359 if (FLAG_IS_DEFAULT(UseHugeTLBFS) && |
3362 FLAG_IS_DEFAULT(UseSHM) && | 3360 FLAG_IS_DEFAULT(UseSHM) && |
3363 FLAG_IS_DEFAULT(UseTransparentHugePages)) { | 3361 FLAG_IS_DEFAULT(UseTransparentHugePages)) { |
3364 // If UseLargePages is specified on the command line try all methods, | 3362 |
3365 // if it's default, then try only UseTransparentHugePages. | 3363 // The type of large pages has not been specified by the user. |
3366 if (FLAG_IS_DEFAULT(UseLargePages)) { | 3364 |
3367 UseTransparentHugePages = true; | 3365 // Try UseHugeTLBFS and then UseSHM. |
3368 } else { | 3366 UseHugeTLBFS = UseSHM = true; |
3369 UseHugeTLBFS = UseTransparentHugePages = UseSHM = true; | 3367 |
3370 } | 3368 // Don't try UseTransparentHugePages since there are known |
3369 // performance issues with it turned on. This might change in the future. | |
3370 UseTransparentHugePages = false; | |
3371 } | 3371 } |
3372 | 3372 |
3373 if (UseTransparentHugePages) { | 3373 if (UseTransparentHugePages) { |
3374 bool warn_on_failure = !FLAG_IS_DEFAULT(UseTransparentHugePages); | 3374 bool warn_on_failure = !FLAG_IS_DEFAULT(UseTransparentHugePages); |
3375 if (transparent_huge_pages_sanity_check(warn_on_failure, page_size)) { | 3375 if (transparent_huge_pages_sanity_check(warn_on_failure, page_size)) { |
3391 | 3391 |
3392 return UseSHM; | 3392 return UseSHM; |
3393 } | 3393 } |
3394 | 3394 |
3395 void os::large_page_init() { | 3395 void os::large_page_init() { |
3396 if (!UseLargePages) { | 3396 if (!UseLargePages && |
3397 !UseTransparentHugePages && | |
3398 !UseHugeTLBFS && | |
3399 !UseSHM) { | |
3400 // Not using large pages. | |
3401 return; | |
3402 } | |
3403 | |
3404 if (!FLAG_IS_DEFAULT(UseLargePages) && !UseLargePages) { | |
3405 // The user explicitly turned off large pages. | |
3406 // Ignore the rest of the large pages flags. | |
3407 UseTransparentHugePages = false; | |
3397 UseHugeTLBFS = false; | 3408 UseHugeTLBFS = false; |
3398 UseTransparentHugePages = false; | |
3399 UseSHM = false; | 3409 UseSHM = false; |
3400 return; | 3410 return; |
3401 } | 3411 } |
3402 | 3412 |
3403 size_t large_page_size = Linux::setup_large_page_size(); | 3413 size_t large_page_size = Linux::setup_large_page_size(); |
4736 | 4746 |
4737 // main_thread points to the aboriginal thread | 4747 // main_thread points to the aboriginal thread |
4738 Linux::_main_thread = pthread_self(); | 4748 Linux::_main_thread = pthread_self(); |
4739 | 4749 |
4740 Linux::clock_init(); | 4750 Linux::clock_init(); |
4741 initial_time_count = os::elapsed_counter(); | 4751 initial_time_count = javaTimeNanos(); |
4742 | 4752 |
4743 // pthread_condattr initialization for monotonic clock | 4753 // pthread_condattr initialization for monotonic clock |
4744 int status; | 4754 int status; |
4745 pthread_condattr_t* _condattr = os::Linux::condAttr(); | 4755 pthread_condattr_t* _condattr = os::Linux::condAttr(); |
4746 if ((status = pthread_condattr_init(_condattr)) != 0) { | 4756 if ((status = pthread_condattr_init(_condattr)) != 0) { |