-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBenchmark.h
79 lines (66 loc) · 1.8 KB
/
Benchmark.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/************************************************************
> File Name: BenchMark.h
> Author: Weidong, ZHANG
> Mail: [email protected]
> Created Time: Sat 07 Mar 2015 07:06:13 PM PST
***********************************************************/
#include <iostream>
#include <iomanip>
#include <ctime>
#include <memory>
#include <sys/time.h>
#include "pdfs.h"
#include "LocalFileSystem.h"
#include "Cluster.h"
#include "TCPNetworkInterface.h"
#include "UDPNetworkInterface.h"
using namespace std;
using namespace pdfs;
namespace benchmark {
const ssize_t TCP_MODE = 0;
const ssize_t UDP_MODE = 1;
class TimeMeasure;
class Benchmark {
public:
Benchmark();
virtual void test() = 0;
virtual ~Benchmark();
protected:
shared_ptr<Cluster> _cluster;
shared_ptr<TimeMeasure> _tm;
shared_ptr<NetworkInterface> _nfi;
};// end of class Benchmark
class ConnectionTime : public Benchmark {
public:
ConnectionTime();
ConnectionTime(Cluster &cluster);
void test();
private:
ssize_t mode;
}; // end of class ConnectionTimeTest
class TransFileTime : public Benchmark {
public:
TransFileTime();
TransFileTime(Cluster &cluster);
void test();
void testTransFile(string filename);
void testTransDir(string dirname);
};
class NetworkUseRate : public Benchmark {
public:
NetworkUseRate();
NetworkUseRate(Cluster &cluster);
void test();
};
class TimeMeasure {
public:
TimeMeasure();
struct timeval start();
struct timeval stop();
double getRuntime();
struct timeval getBegintime();
struct timeval getEndtime();
private:
struct timeval begin_time, end_time;
}; // end of class TimeMeasure
} // end of namespace