Last change
on this file since 11290 was 11290, checked in by lyard, 13 years ago |
Moved the files statistics to a separate class and improved transitions
|
File size:
1.6 KB
|
Line | |
---|
1 | //*************************************************************************************
|
---|
2 | /** @class FilesStatisticsService
|
---|
3 | *
|
---|
4 | * @brief provides a statistics service telling the free space on disk and the total size written so far
|
---|
5 | *
|
---|
6 | */
|
---|
7 | //*************************************************************************************
|
---|
8 | #ifndef FILESSTATISTICSSERVICE_H_
|
---|
9 | #define FILESSTATISTICSSERVICE_H_
|
---|
10 |
|
---|
11 | #include "MessageDim.h"
|
---|
12 | #include <boost/thread.hpp>
|
---|
13 | #include <mutex>
|
---|
14 | #include <string>
|
---|
15 | #include <set>
|
---|
16 |
|
---|
17 | using namespace std;
|
---|
18 |
|
---|
19 | struct FileStatisticsData {
|
---|
20 | long sizeWritten;
|
---|
21 | long freeSpace;
|
---|
22 | long writingRate;
|
---|
23 | };
|
---|
24 | class FilesStatisticsService
|
---|
25 | {
|
---|
26 | private:
|
---|
27 | string fServerName;
|
---|
28 | string fCurrentFolder;
|
---|
29 | boost::thread fThread;
|
---|
30 | FileStatisticsData fStats;
|
---|
31 | mutex fMutex;
|
---|
32 | DimDescribedService* fService;
|
---|
33 | bool fContinueStats;
|
---|
34 | bool fDebug;
|
---|
35 | void UpdateService();
|
---|
36 | long GetFreeSpace();
|
---|
37 | long GetFileSizeOnDisk(const string& file);
|
---|
38 | long fBaseSize;
|
---|
39 | set<string> fOpenedFiles;
|
---|
40 | float fPeriodDuration;
|
---|
41 | MessageImp* fMess;
|
---|
42 | public:
|
---|
43 | ///Default constructor
|
---|
44 | // FilesStatisticsService();
|
---|
45 | FilesStatisticsService(const string& serverName, MessageImp* mess);
|
---|
46 | ///Default destructor
|
---|
47 | ~FilesStatisticsService();
|
---|
48 | ///Configures that current folder where files are written to
|
---|
49 | bool SetCurrentFolder(string& folder);
|
---|
50 | bool FileOpened(const string& fileName);
|
---|
51 | void SetDebugMode(bool);
|
---|
52 | void SetStatPeriod(float duration);
|
---|
53 | void GetTotalSizeWritten(FileStatisticsData& data);
|
---|
54 | void Reset();
|
---|
55 | };
|
---|
56 |
|
---|
57 | #endif /* FILESSTATISTICSSERVICE_H_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.