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

« back to all changes in this revision

Viewing changes to storage/ndb/test/crund/tws/tws_cpp/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: c++; 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 <sys/time.h>
 
30
 
 
31
#include "Properties.hpp"
 
32
 
 
33
using std::string;
 
34
using std::vector;
 
35
using std::ofstream;
 
36
using std::ostringstream;
 
37
 
 
38
using utils::Properties;
 
39
 
 
40
class Driver {
 
41
public:
 
42
 
 
43
    /**
 
44
     * Parses the benchmark's command-line arguments.
 
45
     */
 
46
    static void parseArguments(int argc, const char* argv[]);
 
47
 
 
48
    /**
 
49
     * Creates an instance.
 
50
     */
 
51
    Driver() {}
 
52
 
 
53
    /**
 
54
     * Deletes an instance.
 
55
     */
 
56
    virtual ~Driver() {}
 
57
 
 
58
    /**
 
59
     * Runs the benchmark.
 
60
     */
 
61
    void run();
 
62
 
 
63
protected:
 
64
 
 
65
    // command-line arguments
 
66
    static vector< string > propFileNames;
 
67
    static string logFileName;
 
68
 
 
69
    static void exitUsage();
 
70
 
 
71
    // driver settings
 
72
    Properties props;
 
73
    int warmupRuns;
 
74
 
 
75
    // driver resources
 
76
    ofstream log;
 
77
    string descr;
 
78
    bool logHeader;
 
79
    ostringstream header;
 
80
    ostringstream rtimes;
 
81
    struct timeval t0, t1;
 
82
    long rta;
 
83
 
 
84
    // driver intializers/finalizers
 
85
    virtual void init();
 
86
    virtual void close();
 
87
    virtual void loadProperties();
 
88
    virtual void initProperties();
 
89
    virtual void printProperties();
 
90
    virtual void openLogFile();
 
91
    virtual void closeLogFile();
 
92
 
 
93
    // benchmark operations
 
94
    virtual void runTests() = 0;
 
95
    virtual void clearLogBuffers();
 
96
    virtual void writeLogBuffers();
 
97
    virtual void begin(const string& name);
 
98
    virtual void finish(const string& name);
 
99
};
 
100
 
 
101
#endif // Driver_hpp