Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_RUNTIME_PARSED_OPTIONS_H_ |
| 18 | #define ART_RUNTIME_PARSED_OPTIONS_H_ |
| 19 | |
| 20 | #include <string> |
| 21 | |
| 22 | #include "runtime.h" |
| 23 | #include "trace.h" |
| 24 | |
| 25 | namespace art { |
| 26 | |
| 27 | class ParsedOptions { |
| 28 | public: |
| 29 | // returns null if problem parsing and ignore_unrecognized is false |
| 30 | static ParsedOptions* Create(const Runtime::Options& options, bool ignore_unrecognized); |
| 31 | |
| 32 | const std::vector<const DexFile*>* boot_class_path_; |
| 33 | std::string boot_class_path_string_; |
| 34 | std::string class_path_string_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 35 | std::string image_; |
| 36 | bool check_jni_; |
| 37 | std::string jni_trace_; |
| 38 | CompilerCallbacks* compiler_callbacks_; |
| 39 | bool is_zygote_; |
| 40 | bool interpreter_only_; |
| 41 | bool is_explicit_gc_disabled_; |
| 42 | bool use_tlab_; |
| 43 | bool verify_pre_gc_heap_; |
Mathieu Chartier | 6f365cc | 2014-04-23 12:42:27 -0700 | [diff] [blame] | 44 | bool verify_pre_sweeping_heap_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 45 | bool verify_post_gc_heap_; |
| 46 | bool verify_pre_gc_rosalloc_; |
Mathieu Chartier | 6f365cc | 2014-04-23 12:42:27 -0700 | [diff] [blame] | 47 | bool verify_pre_sweeping_rosalloc_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 48 | bool verify_post_gc_rosalloc_; |
Andreas Gampe | 39d9218 | 2014-03-05 16:46:44 -0800 | [diff] [blame] | 49 | unsigned int long_pause_log_threshold_; |
| 50 | unsigned int long_gc_log_threshold_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 51 | bool dump_gc_performance_on_shutdown_; |
| 52 | bool ignore_max_footprint_; |
| 53 | size_t heap_initial_size_; |
| 54 | size_t heap_maximum_size_; |
| 55 | size_t heap_growth_limit_; |
| 56 | size_t heap_min_free_; |
| 57 | size_t heap_max_free_; |
| 58 | double heap_target_utilization_; |
Mathieu Chartier | 2f8da3e | 2014-04-15 15:37:02 -0700 | [diff] [blame] | 59 | double foreground_heap_growth_multiplier_; |
Andreas Gampe | 39d9218 | 2014-03-05 16:46:44 -0800 | [diff] [blame] | 60 | unsigned int parallel_gc_threads_; |
| 61 | unsigned int conc_gc_threads_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 62 | gc::CollectorType collector_type_; |
| 63 | gc::CollectorType background_collector_type_; |
| 64 | size_t stack_size_; |
Andreas Gampe | 39d9218 | 2014-03-05 16:46:44 -0800 | [diff] [blame] | 65 | unsigned int max_spins_before_thin_lock_inflation_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 66 | bool low_memory_mode_; |
Andreas Gampe | 39d9218 | 2014-03-05 16:46:44 -0800 | [diff] [blame] | 67 | unsigned int lock_profiling_threshold_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 68 | std::string stack_trace_file_; |
| 69 | bool method_trace_; |
| 70 | std::string method_trace_file_; |
Andreas Gampe | 39d9218 | 2014-03-05 16:46:44 -0800 | [diff] [blame] | 71 | unsigned int method_trace_file_size_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 72 | bool (*hook_is_sensitive_thread_)(); |
| 73 | jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap); |
| 74 | void (*hook_exit_)(jint status); |
| 75 | void (*hook_abort_)(); |
| 76 | std::vector<std::string> properties_; |
| 77 | std::vector<std::string> compiler_options_; |
| 78 | std::vector<std::string> image_compiler_options_; |
| 79 | bool profile_; |
| 80 | std::string profile_output_filename_; |
| 81 | uint32_t profile_period_s_; |
| 82 | uint32_t profile_duration_s_; |
| 83 | uint32_t profile_interval_us_; |
| 84 | double profile_backoff_coefficient_; |
Calin Juravle | 1659006 | 2014-04-07 18:07:43 +0300 | [diff] [blame] | 85 | bool profile_start_immediately_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 86 | ProfilerClockSource profile_clock_source_; |
Jeff Hao | 4a200f5 | 2014-04-01 14:58:49 -0700 | [diff] [blame] | 87 | bool verify_; |
Narayan Kamath | 11d9f06 | 2014-04-23 20:24:57 +0100 | [diff] [blame] | 88 | InstructionSet image_isa_; |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 89 | |
Dave Allison | b373e09 | 2014-02-20 16:06:36 -0800 | [diff] [blame] | 90 | static constexpr uint32_t kExplicitNullCheck = 1; |
| 91 | static constexpr uint32_t kExplicitSuspendCheck = 2; |
| 92 | static constexpr uint32_t kExplicitStackOverflowCheck = 4; |
| 93 | uint32_t explicit_checks_; |
| 94 | |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 95 | private: |
| 96 | ParsedOptions() {} |
| 97 | |
| 98 | void Usage(const char* fmt, ...); |
| 99 | void UsageMessage(FILE* stream, const char* fmt, ...); |
| 100 | void UsageMessageV(FILE* stream, const char* fmt, va_list ap); |
| 101 | |
| 102 | void Exit(int status); |
| 103 | void Abort(); |
| 104 | |
| 105 | bool Parse(const Runtime::Options& options, bool ignore_unrecognized); |
Mathieu Chartier | 6f365cc | 2014-04-23 12:42:27 -0700 | [diff] [blame] | 106 | bool ParseXGcOption(const std::string& option); |
Brian Carlstrom | 491ca9e | 2014-03-02 18:24:38 -0800 | [diff] [blame] | 107 | bool ParseStringAfterChar(const std::string& option, char after_char, std::string* parsed_value); |
| 108 | bool ParseInteger(const std::string& option, char after_char, int* parsed_value); |
| 109 | bool ParseUnsignedInteger(const std::string& option, char after_char, unsigned int* parsed_value); |
| 110 | bool ParseDouble(const std::string& option, char after_char, double min, double max, |
| 111 | double* parsed_value); |
| 112 | }; |
| 113 | |
| 114 | } // namespace art |
| 115 | |
| 116 | #endif // ART_RUNTIME_PARSED_OPTIONS_H_ |