~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to storage/ndb/test/crund/src/crundndb/Driver.hpp

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: java; c-basic-offset: 4; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=4:tabstop=4:smarttab:
 
3
 *
 
4
 *  Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef Driver_hpp
 
21
#define Driver_hpp
 
22
 
 
23
#include <iostream>
 
24
#include <sstream>
 
25
#include <fstream>
 
26
#include <string>
 
27
#include <vector>
 
28
 
 
29
#include "Properties.hpp"
 
30
#include "hrt_utils.h"
 
31
 
 
32
using std::ofstream;
 
33
using std::ostringstream;
 
34
using std::string;
 
35
using std::vector;
 
36
 
 
37
using utils::Properties;
 
38
 
 
39
class Driver {
 
40
public:
 
41
 
 
42
    /**
 
43
     * Parses the benchmark's command-line arguments.
 
44
     */
 
45
    static void parseArguments(int argc, const char* argv[]);
 
46
 
 
47
    /**
 
48
     * Creates an instance.
 
49
     */
 
50
    Driver() {}
 
51
 
 
52
    /**
 
53
     * Deletes an instance.
 
54
     */
 
55
    virtual ~Driver() {}
 
56
 
 
57
    /**
 
58
     * Runs the benchmark.
 
59
     */
 
60
    void run();
 
61
 
 
62
protected:
 
63
 
 
64
    // command-line arguments
 
65
    static vector< string > propFileNames;
 
66
    static string logFileName;
 
67
 
 
68
    static void exitUsage();
 
69
 
 
70
    // driver settings
 
71
    Properties props;
 
72
    bool logRealTime;
 
73
    bool logCpuTime;
 
74
    int nRuns;
 
75
 
 
76
    // driver resources
 
77
    ofstream log;
 
78
    string descr;
 
79
    bool logHeader;
 
80
    ostringstream header;
 
81
    ostringstream rtimes;
 
82
    ostringstream ctimes;
 
83
    int s0, s1;
 
84
    hrt_tstamp t0, t1;
 
85
    long rta, cta;
 
86
 
 
87
    // driver intializers/finalizers
 
88
    virtual void init();
 
89
    virtual void close();
 
90
    virtual void loadProperties();
 
91
    virtual void initProperties();
 
92
    virtual void printProperties();
 
93
    virtual void openLogFile();
 
94
    virtual void closeLogFile();
 
95
 
 
96
    // benchmark operations
 
97
    virtual void runTests() = 0;
 
98
    virtual void begin(const string& name);
 
99
    virtual void commit(const string& name);
 
100
};
 
101
 
 
102
#endif // Driver_hpp