• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef FOUNDATION_APPEXECFWK_SERVICES_KERNEL_SYSTEM_MEMORY_INFO_H
16 #define FOUNDATION_APPEXECFWK_SERVICES_KERNEL_SYSTEM_MEMORY_INFO_H
17 
18 #include <map>
19 
20 namespace OHOS {
21 namespace AppExecFwk {
22 namespace SystemEnv {
23 class KernelSystemMemoryInfo {
24 public:
25     KernelSystemMemoryInfo() = default;
26     ~KernelSystemMemoryInfo() = default;
27 
28     void Init(std::map<std::string, std::string> &memInfo);
29 
30     int64_t GetMemTotal() const;
31     int64_t GetMemFree() const;
32     int64_t GetMemAvailable() const;
33     int64_t GetBuffers() const;
34     int64_t GetCached() const;
35     int64_t GetSwapCached() const;
36 
37 private:
38     int64_t memTotal_ = 0;
39     int64_t memFree_ = 0;
40     int64_t memAvailable_ = 0;
41     int64_t buffers_ = 0;
42     int64_t cached_ = 0;
43     int64_t swapCached_ = 0;
44 };
45 }  // namespace SystemEnv
46 }  // namespace AppExecFwk
47 }  // namespace OHOS
48 #endif // FOUNDATION_APPEXECFWK_SERVICES_KERNEL_SYSTEM_MEMORY_INFO_H