aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/main.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-23 19:22:08 +0100
committerGitHub Enterprise <[email protected]>2026-03-23 19:22:08 +0100
commit440ef03df8d8bba4432126f36168c1f7631c18dc (patch)
tree07d4bd4446a11589c9a842255bf37c25aaded74b /src/zenserver/main.cpp
parentMerge branch 'de/v5.7.25-hotpatch' (#880) (diff)
downloadzen-440ef03df8d8bba4432126f36168c1f7631c18dc.tar.xz
zen-440ef03df8d8bba4432126f36168c1f7631c18dc.zip
Cross-platform process metrics support (#887)
- **Cross-platform `GetProcessMetrics`**: Implement Linux (`/proc/{pid}/stat`, `/proc/{pid}/statm`, `/proc/{pid}/status`) and macOS (`proc_pidinfo(PROC_PIDTASKINFO)`) support for CPU times and memory metrics. Fix Windows to populate the `MemoryBytes` field (was always 0). All platforms now set `MemoryBytes = WorkingSetSize`. - **`ProcessMetricsTracker`**: Experimental utility class (`zenutil`) that periodically samples resource usage for a set of tracked child processes. Supports both a dedicated background thread and an ASIO steady_timer mode. Computes delta-based CPU usage percentage across samples, with batched sampling (8 processes per tick) to limit per-cycle overhead. - **`ProcessHandle` documentation**: Add Doxygen comments to all public methods describing platform-specific behavior. - **Cleanup**: Remove unused `ZEN_RUN_TESTS` macro (inlined at its single call site in `zenserver/main.cpp`), remove dead `#if 0` thread-shutdown workaround block. - **Minor fixes**: Use `HttpClientAccessToken` constructor in hordeclient instead of setting private members directly. Log ASIO version at startup and include it in the server settings list.
Diffstat (limited to 'src/zenserver/main.cpp')
-rw-r--r--src/zenserver/main.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp
index dff162b1c..00b7a67d7 100644
--- a/src/zenserver/main.cpp
+++ b/src/zenserver/main.cpp
@@ -249,7 +249,9 @@ test_main(int argc, char** argv)
zen::MaximizeOpenFileCount();
- return ZEN_RUN_TESTS(argc, argv);
+ zen::testing::TestRunner Runner;
+ Runner.ApplyCommandLine(argc, argv);
+ return Runner.Run();
}
#endif
@@ -267,26 +269,6 @@ main(int argc, char* argv[])
using namespace zen;
using namespace std::literals;
- // note: doctest has locally (in thirdparty) been fixed to not cause shutdown
- // crashes due to TLS destructors
- //
- // mimalloc on the other hand might still be causing issues, in which case
- // we should work out either how to eliminate the mimalloc dependency or how
- // to configure it in a way that doesn't cause shutdown issues
-
-#if 0
- auto _ = zen::MakeGuard([] {
- // Allow some time for worker threads to unravel, in an effort
- // to prevent shutdown races in TLS object destruction, mainly due to
- // threads which we don't directly control (Windows thread pool) and
- // therefore can't join.
- //
- // This isn't a great solution, but for now it seems to help reduce
- // shutdown crashes observed in some situations.
- WaitForThreads(1000);
- });
-#endif
-
enum
{
kHub,