diff options
author | 2023-09-17 20:31:50 +0600 | |
---|---|---|
committer | 2023-09-18 18:08:40 +0600 | |
commit | 2bc6cf81b4918411243faf9d9c828af6004407bd (patch) | |
tree | 321f70e1fcef2c773d34bed4a75fe1a8cd1dc10b /src/system-stats/system-stats.cpp | |
parent | d68f074f0ae1fd29a452164988dce957ac18982f (diff) | |
download | shopno-os-log-sync-2bc6cf81b4918411243faf9d9c828af6004407bd.tar.gz shopno-os-log-sync-2bc6cf81b4918411243faf9d9c828af6004407bd.zip |
system-stats: Add system pressure stats logger
Signed-off-by: Mubashshir <ahm@jadupc.com>
Diffstat (limited to 'src/system-stats/system-stats.cpp')
-rw-r--r-- | src/system-stats/system-stats.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/system-stats/system-stats.cpp b/src/system-stats/system-stats.cpp new file mode 100644 index 0000000..4d2f43e --- /dev/null +++ b/src/system-stats/system-stats.cpp @@ -0,0 +1,28 @@ +#include <thread> +#include <iostream> + +#include "common.h" + +using namespace std::literals; + +int main() +{ + namespace CH = std::chrono; + + auto logf = LogFile(); + refstream stream = std::ref(std::cout); + + while(1) { + logf.change(stream); + auto epoch = CH::duration_cast<CH::seconds>( + CH::system_clock::now().time_since_epoch() + ).count(); + + stream.get() << "begin\t" << epoch << std::endl; + stream.get() << dumpReport(); + stream.get() << "end\t" << epoch << std::endl; + + std::this_thread::sleep_for(1s); + } + return 0; +} |