Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
proc-info-test.cc
Go to the documentation of this file.
1 // Copyright 2015 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 #include <iostream>
16 #include <sstream>
17 #include <stdio.h>
18 #include <stdlib.h>
19 
20 #include <gtest/gtest.h>
21 
22 #include "common/init.h"
23 #include "service/fe-support.h"
24 #include "util/mem-info.h"
26 #include "util/test-info.h"
27 
28 #include "common/names.h"
29 
30 namespace impala {
31 
32 TEST(MemInfo, Basic) {
33  ASSERT_GT(MemInfo::physical_mem(), 0);
34  ASSERT_LT(MemInfo::vm_overcommit(), 3);
35  ASSERT_GE(MemInfo::vm_overcommit(), 0);
36  ASSERT_GT(MemInfo::commit_limit(), 0);
37 }
38 
40  ProcessStateInfo process_state_info;
41  ASSERT_GE(process_state_info.GetBytes("io/read_bytes"), 0);
42  ASSERT_GE(process_state_info.GetInt("sched/prio"), 0);
43  ASSERT_GE(process_state_info.GetInt("status/Threads"), 0);
44 }
45 
46 }
47 
48 int main(int argc, char **argv) {
49  ::testing::InitGoogleTest(&argc, argv);
52  return RUN_ALL_TESTS();
53 }
void InitFeSupport()
Definition: fe-support.cc:346
static int64_t physical_mem()
Get total physical memory in bytes (ignores cgroups memory limits).
Definition: mem-info.h:36
void InitCommonRuntime(int argc, char **argv, bool init_jvm, TestInfo::Mode m=TestInfo::NON_TEST)
Definition: init.cc:122
TEST(AtomicTest, Basic)
Definition: atomic-test.cc:28
int64_t GetBytes(const string &state_key) const
Original data's unit is B or KB.
int GetInt(const string &state_key) const
static int32_t vm_overcommit()
Returns the systems memory overcommit settings, typically the values are 0,1, and 2...
Definition: mem-info.h:42
int main(int argc, char **argv)
static int64_t commit_limit()
Definition: mem-info.h:49