Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
disk-io-mgr-stress-test.cc
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 
16 #include "util/cpu-info.h"
17 #include "util/string-parser.h"
18 
19 #include "common/names.h"
20 
21 using namespace impala;
22 
23 // Simple utility to run the disk io stress test. A optional second parameter
24 // can be passed to control how long to run this test (0 for forever).
25 
26 // TODO: make these configurable once we decide how to run BE tests with args
27 const int DEFAULT_DURATION_SEC = 1;
28 const int NUM_DISKS = 5;
29 const int NUM_THREADS_PER_DISK = 5;
30 const int NUM_CLIENTS = 10;
31 const bool TEST_CANCELLATION = true;
32 
33 int main(int argc, char** argv) {
34  google::InitGoogleLogging(argv[0]);
35  CpuInfo::Init();
37  int duration_sec = DEFAULT_DURATION_SEC;
38 
39  if (argc == 2) {
41  duration_sec = StringParser::StringToInt<int>(argv[1], strlen(argv[1]), &status);
42  if (status != StringParser::PARSE_SUCCESS) {
43  printf("Invalid arg: %s\n", argv[1]);
44  return 1;
45  }
46  }
47  if (duration_sec != 0) {
48  printf("Running stress test for %d seconds.\n", duration_sec);
49  } else {
50  printf("Running stress test indefinitely.\n");
51  }
53  test.Run(duration_sec);
54 
55  return 0;
56 }
const int NUM_THREADS_PER_DISK
int main(int argc, char **argv)
void InitThreading()
Initialises the threading subsystem. Must be called before a Thread is created.
Definition: thread.cc:261
const int DEFAULT_DURATION_SEC
static void Init()
Initialize CpuInfo.
Definition: cpu-info.cc:75
void Run(int sec)
Run the test for 'sec'. If 0, run forever.
const bool TEST_CANCELLATION
const int NUM_CLIENTS
const int NUM_DISKS