Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mem-info.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
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 IMPALA_UTIL_MEM_INFO_H
16 #define IMPALA_UTIL_MEM_INFO_H
17 
18 #include <string>
19 #include <boost/cstdint.hpp>
20 
21 #include "common/logging.h"
22 
23 namespace impala {
24 
30 class MemInfo {
31  public:
33  static void Init();
34 
36  static int64_t physical_mem() {
37  DCHECK(initialized_);
38  return physical_mem_;
39  }
40 
42  static int32_t vm_overcommit() {
43  DCHECK(initialized_);
44  return vm_overcommit_;
45  }
46 
49  static int64_t commit_limit() {
50  DCHECK(initialized_);
51  return commit_limit_;
52  }
53 
54  static std::string DebugString();
55 
56  private:
57 
58  static void ParseOvercommit();
59 
60  static bool initialized_;
61  static int64_t physical_mem_;
62 
67 
69  //(e.g. heuristic based / always / strict)
70  static int32_t vm_overcommit_;
71 
73  static int64_t commit_limit_;
74 };
75 
76 }
77 #endif
static int32_t vm_overcommit_
Indicating the kernel overcommit settings.
Definition: mem-info.h:70
static int64_t physical_mem()
Get total physical memory in bytes (ignores cgroups memory limits).
Definition: mem-info.h:36
static void Init()
Initialize MemInfo.
Definition: mem-info.cc:54
static int64_t physical_mem_
Definition: mem-info.h:61
static int32_t vm_overcommit()
Returns the systems memory overcommit settings, typically the values are 0,1, and 2...
Definition: mem-info.h:42
static std::string DebugString()
Definition: mem-info.cc:96
static void ParseOvercommit()
Definition: mem-info.cc:91
static bool initialized_
Definition: mem-info.h:60
static int64_t commit_limit_
If overcommit is turned off the maximum allocatable memory.
Definition: mem-info.h:73
static int64_t commit_limit()
Definition: mem-info.h:49