finish the logging session and receive the .etl file
| 26 | } |
| 27 | // finish the logging session and receive the .etl file |
| 28 | void EtlLogger::Finish(const std::filesystem::path& outputEtlFullPath) |
| 29 | { |
| 30 | char buffer[PM_MAX_PATH + 1]; |
| 31 | if (auto sta = pmFinishEtlLogging(hSession_, hLogger_, buffer, (uint32_t)std::size(buffer)); |
| 32 | sta != PM_STATUS_SUCCESS) { |
| 33 | Clear_(); |
| 34 | throw ApiErrorException{ sta, "Failed to finish etl logging" }; |
| 35 | } |
| 36 | try { |
| 37 | std::filesystem::rename(buffer, outputEtlFullPath); |
| 38 | Clear_(); |
| 39 | } |
| 40 | catch (...) { |
| 41 | // attempt to remove if still there |
| 42 | std::error_code ec; |
| 43 | std::filesystem::remove(buffer, ec); |
| 44 | throw ApiErrorException{ PM_STATUS_FAILURE, "Failed to move output .etl file" }; |
| 45 | } |
| 46 | } |
| 47 | // get the id of process being tracked |
| 48 | PM_ETL_HANDLE EtlLogger::GetHandle() const |
| 49 | { |
no test coverage detected