blob: d0f3c125c71954ff71fc47bad29aa9563fbe5290 [file] [log] [blame]
Brian Carlstrom491ca9e2014-03-02 18:24:38 -08001/*
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
Ian Rogers576ca0c2014-06-06 15:58:22 -070022#include "gc/collector_type.h"
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080023#include "runtime.h"
24#include "trace.h"
25
26namespace art {
27
28class ParsedOptions {
29 public:
30 // returns null if problem parsing and ignore_unrecognized is false
31 static ParsedOptions* Create(const Runtime::Options& options, bool ignore_unrecognized);
32
33 const std::vector<const DexFile*>* boot_class_path_;
34 std::string boot_class_path_string_;
35 std::string class_path_string_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080036 std::string image_;
37 bool check_jni_;
38 std::string jni_trace_;
39 CompilerCallbacks* compiler_callbacks_;
40 bool is_zygote_;
41 bool interpreter_only_;
42 bool is_explicit_gc_disabled_;
43 bool use_tlab_;
44 bool verify_pre_gc_heap_;
Mathieu Chartier6f365cc2014-04-23 12:42:27 -070045 bool verify_pre_sweeping_heap_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080046 bool verify_post_gc_heap_;
47 bool verify_pre_gc_rosalloc_;
Mathieu Chartier6f365cc2014-04-23 12:42:27 -070048 bool verify_pre_sweeping_rosalloc_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080049 bool verify_post_gc_rosalloc_;
Andreas Gampe39d92182014-03-05 16:46:44 -080050 unsigned int long_pause_log_threshold_;
51 unsigned int long_gc_log_threshold_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080052 bool dump_gc_performance_on_shutdown_;
53 bool ignore_max_footprint_;
54 size_t heap_initial_size_;
55 size_t heap_maximum_size_;
56 size_t heap_growth_limit_;
57 size_t heap_min_free_;
58 size_t heap_max_free_;
59 double heap_target_utilization_;
Mathieu Chartier2f8da3e2014-04-15 15:37:02 -070060 double foreground_heap_growth_multiplier_;
Andreas Gampe39d92182014-03-05 16:46:44 -080061 unsigned int parallel_gc_threads_;
62 unsigned int conc_gc_threads_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080063 gc::CollectorType collector_type_;
64 gc::CollectorType background_collector_type_;
65 size_t stack_size_;
Andreas Gampe39d92182014-03-05 16:46:44 -080066 unsigned int max_spins_before_thin_lock_inflation_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080067 bool low_memory_mode_;
Andreas Gampe39d92182014-03-05 16:46:44 -080068 unsigned int lock_profiling_threshold_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080069 std::string stack_trace_file_;
70 bool method_trace_;
71 std::string method_trace_file_;
Andreas Gampe39d92182014-03-05 16:46:44 -080072 unsigned int method_trace_file_size_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080073 bool (*hook_is_sensitive_thread_)();
74 jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap);
75 void (*hook_exit_)(jint status);
76 void (*hook_abort_)();
77 std::vector<std::string> properties_;
Tsu Chiang Chuang12e6d742014-05-22 10:22:25 -070078 std::string compiler_executable_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080079 std::vector<std::string> compiler_options_;
80 std::vector<std::string> image_compiler_options_;
Calin Juravlec1b643c2014-05-30 23:44:11 +010081 ProfilerOptions profiler_options_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080082 std::string profile_output_filename_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080083 ProfilerClockSource profile_clock_source_;
Jeff Hao4a200f52014-04-01 14:58:49 -070084 bool verify_;
Narayan Kamath11d9f062014-04-23 20:24:57 +010085 InstructionSet image_isa_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080086
Nicolas Geoffray0025a862014-07-11 08:26:40 +000087 static constexpr uint32_t kExplicitNullCheck = 1;
88 static constexpr uint32_t kExplicitSuspendCheck = 2;
89 static constexpr uint32_t kExplicitStackOverflowCheck = 4;
90 uint32_t explicit_checks_;
91
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080092 private:
93 ParsedOptions() {}
94
95 void Usage(const char* fmt, ...);
96 void UsageMessage(FILE* stream, const char* fmt, ...);
97 void UsageMessageV(FILE* stream, const char* fmt, va_list ap);
98
99 void Exit(int status);
100 void Abort();
101
102 bool Parse(const Runtime::Options& options, bool ignore_unrecognized);
Mathieu Chartier6f365cc2014-04-23 12:42:27 -0700103 bool ParseXGcOption(const std::string& option);
Brian Carlstrom491ca9e2014-03-02 18:24:38 -0800104 bool ParseStringAfterChar(const std::string& option, char after_char, std::string* parsed_value);
105 bool ParseInteger(const std::string& option, char after_char, int* parsed_value);
106 bool ParseUnsignedInteger(const std::string& option, char after_char, unsigned int* parsed_value);
107 bool ParseDouble(const std::string& option, char after_char, double min, double max,
108 double* parsed_value);
109};
110
111} // namespace art
112
113#endif // ART_RUNTIME_PARSED_OPTIONS_H_