A small Windows systems-style monitoring tool written in C++ that samples CPU and memory usage and logs results to a CSV file.
- Reads CPU utilization (%) using Windows
GetSystemTimes(computed from time deltas). - Reads memory utilization (%) using Windows
GlobalMemoryStatusEx. - Prints metrics to the console once per second.
- Logs metrics to a CSV file:
timestamp,cpu_percent,mem_percent. - Includes basic error handling so logging failures do not crash metric collection.
- Runs until the user presses any key.
- src/
- main.cpp
- SystemMetrics.h/.cpp
- Logger.h/.cpp
- TimeUtil.h/.cpp
- Open Visual Studio (C++ desktop development installed).
- Create a Console App (C++) project.
- Add the files from
src/into your project (Source Files + Header Files). - Build and run.
Console output (example):
2026-01-06 11:22:18 | CPU: 9.91% | MEM: 81.00%
2026-01-06 11:22:19 | CPU: 7.67% | MEM: 81.00%
- C++ (Visual Studio / MSVC)
- Windows API:
GetSystemTimes,GlobalMemoryStatusEx