summaryrefslogtreecommitdiffstats
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-07-23 13:17:59 -0700
committerMathieu Chartier <mathieuc@google.com>2013-07-23 13:55:18 -0700
commit63a54345598861030178e033ffbd72c0e231a4c9 (patch)
tree0241f931c8fb8876a1c3ffbc07198c1d7c8e9a4f /runtime/runtime.cc
parent4560248d4c85cade7f4fc7b30c3fb41b95a04a7f (diff)
downloadart-63a54345598861030178e033ffbd72c0e231a4c9.zip
art-63a54345598861030178e033ffbd72c0e231a4c9.tar.gz
art-63a54345598861030178e033ffbd72c0e231a4c9.tar.bz2
Add option for changing number of GC threads.
The number of threads was previously set to 1 by an accidential checkin. This hurts on all devices which aren't dual core. We now properly use sysconf to determine how many threads we should create. Also added a -XX:HeapGCThreads heap option which lets us change how many GC threads we create. The default value is equal to the number of processors on the device minus one. Change-Id: If65065ef09174a3813b8741efdd5ea7bbe82a4e2
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index ba18311..cf6e537 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -338,6 +338,8 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b
parsed->heap_max_free_ = gc::Heap::kDefaultMaxFree;
parsed->heap_target_utilization_ = gc::Heap::kDefaultTargetUtilization;
parsed->heap_growth_limit_ = 0; // 0 means no growth limit.
+ // Default to number of processors minus one since the main GC thread also does work.
+ parsed->heap_gc_threads_ = sysconf(_SC_NPROCESSORS_CONF) - 1;
parsed->stack_size_ = 0; // 0 means default.
parsed->is_compiler_ = false;
@@ -472,6 +474,9 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b
return NULL;
}
parsed->heap_target_utilization_ = value;
+ } else if (StartsWith(option, "-XX:HeapGCThreads=")) {
+ parsed->heap_gc_threads_ =
+ ParseMemoryOption(option.substr(strlen("-XX:HeapGCThreads=")).c_str(), 1024);
} else if (StartsWith(option, "-Xss")) {
size_t size = ParseMemoryOption(option.substr(strlen("-Xss")).c_str(), 1);
if (size == 0) {
@@ -829,7 +834,8 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
options->heap_target_utilization_,
options->heap_maximum_size_,
options->image_,
- options->is_concurrent_gc_enabled_);
+ options->is_concurrent_gc_enabled_,
+ options->heap_gc_threads_);
BlockSignals();
InitPlatformSignalHandlers();