18 #include <unordered_map>
24 static std::list<std::string>
scanNetworkDevices(
const std::string& ethernetDataFile=
"/proc/net/dev");
26 std::vector<std::shared_ptr<networkLoad>>
v;
28 v.push_back(std::make_shared<networkLoad>(ethernetDataFileName,elem));
33 explicit networkLoad(std::string ethernetDataFileName =
"/proc/net/dev", std::string ethName =
"eth0");
68 std::string ethernetDataFile;
70 bool isDeviceAvailable =
false;
75 std::chrono::system_clock::time_point currentTime;
76 std::chrono::system_clock::time_point timeBefore;
78 std::map<std::string, std::unordered_map<std::string, uint64_t>> ethObj;
79 std::map<std::string, std::unordered_map<std::string, uint64_t>> ethObjOld;
82 static std::shared_ptr<networkParser> getNetworkParser();
84 void parse(
const std::string& netFile =
"/proc/net/dev");
85 const std::unordered_map<std::string, uint64_t> &getEthObj(
const std::string& ethDevice)
const;
86 std::list<std::string> getNetworkDevices(std::string netFile =
"/proc/net/dev");
87 const std::chrono::system_clock::time_point getTimeStamp()
const;
88 const std::unordered_map<std::string, uint64_t> &getEthObjOld(
const std::string& ethDevice)
const;
89 const std::chrono::system_clock::time_point getTimeBefore()
const;
91 static std::shared_ptr<networkParser> inst;