* @brief A class for getting IO read/write bytes */
| 6 | * @brief A class for getting IO read/write bytes |
| 7 | */ |
| 8 | class ProcessIoCounter |
| 9 | { |
| 10 | IO_COUNTERS m_counter[2]{}; |
| 11 | IO_COUNTERS* m_counterPrev = &m_counter[0]; |
| 12 | IO_COUNTERS* m_counterCur = &m_counter[1]; |
| 13 | std::chrono::steady_clock::time_point m_lastUpdate{}; |
| 14 | HANDLE m_handle{ INVALID_HANDLE_VALUE }; |
| 15 | public: |
| 16 | ProcessIoCounter() = default; |
| 17 | |
| 18 | /** |
| 19 | * @brief Initialize with a handle to process |
| 20 | * |
| 21 | * @param handle handle to the process |
| 22 | */ |
| 23 | ProcessIoCounter(HANDLE handle); |
| 24 | |
| 25 | /** |
| 26 | * @brief Set a new process handle to the counter |
| 27 | * |
| 28 | * @param handle a new process handle |
| 29 | */ |
| 30 | void SetHandle(HANDLE handle); |
| 31 | |
| 32 | struct IOCounter |
| 33 | { |
| 34 | ULONGLONG read; |
| 35 | ULONGLONG write; |
| 36 | |
| 37 | IOCounter& operator+=(IOCounter rhs); |
| 38 | IOCounter operator+(IOCounter rhs); |
| 39 | }; |
| 40 | |
| 41 | struct IOCounterDiff : IOCounter |
| 42 | { |
| 43 | std::chrono::nanoseconds duration; |
| 44 | }; |
| 45 | |
| 46 | /** |
| 47 | * @brief Return the amount of IO difference and time difference to last call |
| 48 | */ |
| 49 | IOCounterDiff Update(); |
| 50 | |
| 51 | /** |
| 52 | * @brief Get current total |
| 53 | */ |
| 54 | IOCounter GetTotal(); |
| 55 | }; |
| 56 |
nothing calls this directly
no outgoing calls
no test coverage detected