2 * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef LAUNCHPAD_PROCESS_POOL_CONFIG_HH_
18 #define LAUNCHPAD_PROCESS_POOL_CONFIG_HH_
24 #include <ini_parser.hh>
32 explicit MemoryStatus(const IniParser& parser);
34 const std::string& GetLowKey() const;
35 const int GetLowValue() const;
36 const std::string& GetNormalKey() const;
37 const int GetNormalValue() const;
40 std::string low_key_ = VCONFKEY_SYSMAN_LOW_MEMORY;
41 int low_value_ = VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING;
42 std::string normal_key_ = VCONFKEY_SYSMAN_LOW_MEMORY;
43 int normal_value_ = VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL;
48 explicit MemoryMonitor(const IniParser& parser);
50 const int GetThreshold() const;
51 const int GetInterval() const;
60 explicit CPUChecker(const IniParser& parser);
62 const int GetMaxCount() const;
63 const bool IsEnabled() const;
72 explicit Logger(const IniParser& parser);
74 const std::string& GetPath() const;
75 const bool IsEnabled() const;
78 std::string path_ = "/var/log/appfw";
84 explicit ProcessPool(const IniParser& parser);
86 const int GetNumberOfProcesses() const;
87 const int GetNumberOfLoaderProcesses() const;
90 int number_of_processes_ = 1;
91 int number_of_loader_processes_ = 1;
96 enum class Mode : int {
97 PreviousOperation = 0,
100 AlwaysLoaderWithoutCPUChecker = 3,
101 AlwaysLoaderWithLowPriority = 4,
104 explicit LaunchMode(const IniParser& parser);
106 const Mode GetMode() const;
109 Mode mode_ = Mode::DefaultOperation;
112 Config(const Config&) = delete;
113 Config& operator = (const Config&) = delete;
114 Config(Config&&) = delete;
115 Config& operator = (Config&&) = delete;
117 static Config& GetInst();
119 const MemoryStatus& GetMemoryStatus() const;
120 const MemoryMonitor& GetMemoryMonitor() const;
121 const CPUChecker& GetCPUChecker() const;
122 const Logger& GetLogger() const;
123 const ProcessPool& GetProcessPool() const;
124 const LaunchMode& GetLaunchMode() const;
132 MemoryStatus memory_status_;
133 MemoryMonitor memory_monitor_;
134 CPUChecker cpu_checker_;
136 ProcessPool process_pool_;
137 LaunchMode launch_mode_;
140 } // namespace launchpad
142 #endif // LAUNCHPAD_PROCESS_POOL_CONFIG_HH_