blob: 2b8503df31222bc901f06bdc41f0045ab775e611 (
plain) (
blame)
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
|
#ifndef INCLUDED_p2p_data_logger_hpp
#define INCLUDED_p2p_data_logger_hpp
#include <string>
#include <map>
#include <fstream>
#include <memory>
#include <thread>
#include <mutex>
#include <atomic>
namespace epee
{
namespace net_utils
{
class data_logger {
public:
static data_logger &get_instance();
data_logger(const data_logger &ob) = delete;
data_logger(data_logger &&ob) = delete;
void add_data(std::string filename, unsigned int data);
static std::atomic<bool> m_save_graph;
private:
data_logger();
class fileData
{
public:
fileData(){}
fileData(std::string pFile);
std::shared_ptr<std::ofstream> mFile;
long int mDataToSave = 0;
static double get_current_time();
void save();
};
std::map <std::string, fileData> mFilesMap;
std::mutex mSaveMutex;
void saveToFile();
};
} // namespace
} // namespace
#endif
|