-
Notifications
You must be signed in to change notification settings - Fork 0
/
appManager.h
109 lines (89 loc) · 3.65 KB
/
appManager.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
///
/// appManager.h
///
#ifndef APPMANAGER_H
#define APPMANAGER_H
/// include
#include <vector>
#include <string>
/// const prams
const long long Kay = 1024;
const long long Meg = 1024*1024;
const long long Geg = 1024*1024*1024;
const long long AlignedBlockSize = 512;
///
/// Class GUI_Interface
///
/// Abstract class for accessing the GUI controls.
///
class GUI_Interface{
public:
GUI_Interface() { }
virtual ~GUI_Interface() { }
/// get the start I/O block size index from the GUI combobox
virtual unsigned int blockSizeStartIndex() = 0;
/// get the end IO block size index from the GUI combobox
virtual unsigned int blockSizeEndIndex() = 0;
/// get the file size index from the GUI combobox
virtual unsigned int fileSizeComboIndex() = 0;
/// user want to validate the write data?
virtual bool isValidateChecked() = 0;
/// get the root directory
virtual std::string rootDirectory() = 0;
/// update the status message on the GUI
virtual void updateStatusMessage(std::string msg) = 0;
/// append the new I/O block size to the GUI
virtual void appendToBlockSize(std::string size) = 0;
/// append the new write rate to the GUI
virtual void appendToWriteRate(std::string size) = 0;
/// append the new read rate to the GUI
virtual void appendToReadRate(std::string size) = 0;
/// enable or disable the GUI controls
virtual void restrictGUIElements(bool state) = 0;
/// update the GUI progreess bar
virtual void updateProgressBar(int value) = 0;
};
///
/// Class appManager;
///
/// This class handles the file managements and benchmarking routines.
///
class appManager {
public:
/// Constractor
appManager(GUI_Interface* _gui_interface);
~appManager();
/// Start benchmarking is the main process to start benchmarking, the function takes two booloan prams.
/// directMode - avoid caching the file to the host RAM usually done by the std methods.
/// report - by default report variable is set to true to generate report after finishing the benchmarking.
int startBenchmarking(bool directMode, bool report=true);
/// Flag some GUI controls that the benchmarking process is finished.
void finishedBenchmarking();
/// Fill random data to the buffer.
void fillRandomly(unsigned int size, int *ptr);
/// helper function to attach the rate tag next to the rate for example 11234 B/S rate will be 111.234 GB/S
std::string attachTag(double rate);
/// Generate report function; creates a txt file with the details.
std::string generateReport();
/// vector for storing the measured read rates used when generating the report file.
std::vector<std::string> measuredReadRateVec;
/// vector for storing the measured write rates used when generating the report file.
std::vector<std::string> measuredWriteRateVec;
/// vector for storing the measured I/O block size used when generating the report file.
std::vector<std::string> measuredBlockSizeVec;
/// vector for all the supported I/O block sizes.
std::vector<unsigned long long> blockSizeVec;
/// vector for all the supported file sizes.
std::vector<unsigned long long> FileSizeVec;
/// vector for the I/O block count.
std::vector<unsigned long long> IoCountVec;
/// vector for all the supported I/O block sizes.
std::vector<std::string> IoSizeTagsVec;
/// a local getter function for accessing the benchmark progress.
float benchmarkProgress() { return BenchmarkProgress; }
private:
GUI_Interface *gui_interface;
/// a local public pram for accessing the benchmark progress.
float BenchmarkProgress;
};
#endif // APPMANAGER_H