blob: b94956e84a0995f6fb918add03f5366b33618ca6 [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
22#include "runtime.h"
23#include "trace.h"
24
25namespace art {
26
27class 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_;
35 std::string host_prefix_;
36 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_;
45 bool verify_post_gc_heap_;
46 bool verify_pre_gc_rosalloc_;
47 bool verify_post_gc_rosalloc_;
48 size_t long_pause_log_threshold_;
49 size_t long_gc_log_threshold_;
50 bool dump_gc_performance_on_shutdown_;
51 bool ignore_max_footprint_;
52 size_t heap_initial_size_;
53 size_t heap_maximum_size_;
54 size_t heap_growth_limit_;
55 size_t heap_min_free_;
56 size_t heap_max_free_;
57 double heap_target_utilization_;
58 size_t parallel_gc_threads_;
59 size_t conc_gc_threads_;
60 gc::CollectorType collector_type_;
61 gc::CollectorType background_collector_type_;
62 size_t stack_size_;
63 size_t max_spins_before_thin_lock_inflation_;
64 bool low_memory_mode_;
65 size_t lock_profiling_threshold_;
66 std::string stack_trace_file_;
67 bool method_trace_;
68 std::string method_trace_file_;
69 size_t method_trace_file_size_;
70 bool (*hook_is_sensitive_thread_)();
71 jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap);
72 void (*hook_exit_)(jint status);
73 void (*hook_abort_)();
74 std::vector<std::string> properties_;
75 std::vector<std::string> compiler_options_;
76 std::vector<std::string> image_compiler_options_;
77 bool profile_;
78 std::string profile_output_filename_;
79 uint32_t profile_period_s_;
80 uint32_t profile_duration_s_;
81 uint32_t profile_interval_us_;
82 double profile_backoff_coefficient_;
83 ProfilerClockSource profile_clock_source_;
84
85 private:
86 ParsedOptions() {}
87
88 void Usage(const char* fmt, ...);
89 void UsageMessage(FILE* stream, const char* fmt, ...);
90 void UsageMessageV(FILE* stream, const char* fmt, va_list ap);
91
92 void Exit(int status);
93 void Abort();
94
95 bool Parse(const Runtime::Options& options, bool ignore_unrecognized);
96 bool ParseStringAfterChar(const std::string& option, char after_char, std::string* parsed_value);
97 bool ParseInteger(const std::string& option, char after_char, int* parsed_value);
98 bool ParseUnsignedInteger(const std::string& option, char after_char, unsigned int* parsed_value);
99 bool ParseDouble(const std::string& option, char after_char, double min, double max,
100 double* parsed_value);
101};
102
103} // namespace art
104
105#endif // ART_RUNTIME_PARSED_OPTIONS_H_