From 43af8814456f337b3a98a1dbda1c6dbe123293a2 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 16 May 2023 21:33:15 +0200 Subject: added benchmark utility command `bench` (#298) currently this implements a way (`zen bench --purge`) to purge the standby lists on Windows. This basically flushes the file system cache and is useful to put your system in a consistent state before running benchmarks --- src/zencore/thread.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/zencore/thread.cpp') diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp index fe81cc786..52b1e5d4e 100644 --- a/src/zencore/thread.cpp +++ b/src/zencore/thread.cpp @@ -679,6 +679,25 @@ ProcessHandle::Wait(int TimeoutMs) ThrowLastError("Process::Wait failed"sv); } +int +ProcessHandle::WaitExitCode() +{ + Wait(-1); + +#if ZEN_PLATFORM_WINDOWS + DWORD ExitCode = 0; + GetExitCodeProcess(m_ProcessHandle, &ExitCode); + + ZEN_ASSERT(ExitCode != STILL_ACTIVE); + + return ExitCode; +#else + ZEN_NOT_IMPLEMENTED(); + + return 0; +#endif +} + ////////////////////////////////////////////////////////////////////////// #if !ZEN_PLATFORM_WINDOWS || ZEN_WITH_TESTS -- cgit v1.2.3