You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- CI/CD integration for automated resource monitoring
139
139
140
-
**Platform Support:** This checker is Linux-only and uses `/proc/self/status` for system metrics. It is automatically excluded from Windows and macOS builds.
140
+
**Platform Support:** This checker supports Linux and Windows. On Linux it reads `/proc/self/status`; on Windows it uses the Win32 `PSAPI` and `Toolhelp32` APIs. macOS is not supported.
141
141
142
142
See [System Resource Tracker documentation](checkers/system_resource_tracker/system_resource_tracker.md) for detailed usage and CSV format.
Copy file name to clipboardExpand all lines: source/layers/validation/checkers/system_resource_tracker/system_resource_tracker.md
+40-10Lines changed: 40 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
The System Resource Tracker is a Level Zero validation layer checker that monitors both Level Zero API resources and system resources in real-time. It tracks resource allocation and deallocation across all Level Zero API calls that create or destroy resources, providing detailed insights into memory usage, resource lifecycles, and system-level metrics.
6
6
7
-
**Platform Support:** Linux only. This checker uses`/proc/self/status` for system metrics and is not available on Windows or macOS.
7
+
**Platform Support:** Linux and Windows. On Linux the checker reads`/proc/self/status` for system metrics; on Windows it uses the Win32 `GetProcessMemoryInfo`, `CreateToolhelp32Snapshot`, and `GetProcessHandleCount` APIs. macOS is not supported.
8
8
9
9
## Features
10
10
@@ -14,13 +14,13 @@ The System Resource Tracker is a Level Zero validation layer checker that monito
14
14
- Logs warnings when memory increases during destroy operations
15
15
- Reports cumulative leaks per resource type at program exit
16
16
- Provides detailed per-handle leak information
17
-
-**System Resource Monitoring**: Tracks real system metrics via `/proc/self/status`including:
18
-
- Virtual memory size (VmSize)
19
-
- Resident set size (VmRSS)
20
-
- Data segment size (VmData)
21
-
- Peak virtual memory (VmPeak)
17
+
-**System Resource Monitoring**: Tracks real system metrics including:
18
+
- Virtual memory size (VmSize / PrivateUsage on Windows)
19
+
- Resident set size (VmRSS / WorkingSetSize on Windows)
20
+
- Data segment size (VmData / PrivateUsage on Windows)
21
+
- Peak virtual memory (VmPeak / PeakWorkingSetSize on Windows)
22
22
- Thread count
23
-
- File descriptor count
23
+
- File descriptor / handle count
24
24
-**Signed Delta Tracking**: Calculates both positive and negative resource changes (deltas) for each API call with proper signed arithmetic
25
25
-**Cumulative Summaries**: Maintains running totals of all resource types and leak totals
26
26
-**CSV Export**: Optionally exports timestamped data for graphing and analysis
@@ -34,6 +34,7 @@ The System Resource Tracker is a Level Zero validation layer checker that monito
34
34
35
35
Enable the checker to log resource usage to the Level Zero debug log:
Set the `ZEL_SYSTEM_RESOURCE_TRACKER_CSV` environment variable to specify the output CSV file path, this path will be relative to the current working directory of the application:
**Note:** The actual output file will include the process ID (e.g., `tracker_output_pid12345.csv`) to ensure each process creates a unique file. This prevents conflicts when multiple processes use the tracker simultaneously.
61
84
62
85
## Tracked API Calls
@@ -317,7 +340,7 @@ The System Resource Tracker is implemented as a validation layer checker that us
317
340
- Per-resource-type leak counters
318
341
- Thread-local pre-call metrics storage for append operations
319
342
-`getResourceTracker()`: Function-local static singleton accessor ensuring proper initialization order
320
-
-`getSystemResourceMetrics()`: Parses `/proc/self/status`to read current system metrics
343
+
-`getSystemResourceMetrics()`: Reads current system metrics — parses `/proc/self/status`on Linux; uses `GetProcessMemoryInfo`, `CreateToolhelp32Snapshot`, and `GetProcessHandleCount` on Windows
321
344
-`checkForLeak()`: Compares creation metrics to destruction metrics and logs warnings if memory increased
322
345
-`writeCsvData()`: Atomic CSV line writer using ostringstream with signed delta support
323
346
-`logResourceSummary()`: Formats and logs cumulative resource usage
@@ -335,13 +358,20 @@ The tracker uses multiple mechanisms to ensure thread safety:
335
358
### Performance Considerations
336
359
337
360
- Tracking overhead is approximately < 1ms per API call
338
-
- System metrics are read by parsing a small text file (`/proc/self/status` on Linux)
361
+
- System metrics are read from `/proc/self/status` on Linux or via Win32 `PSAPI` / `Toolhelp32` on Windows
339
362
- CSV writes are buffered and flushed after each call to ensure crash safety
340
363
- The tracker only runs when explicitly enabled via environment variable
341
364
342
365
### Platform Support
343
366
344
-
The System Resource Tracker is **Linux-only** and relies on `/proc/self/status` for system resource metrics. The checker is automatically excluded from builds on Windows and macOS.
367
+
The System Resource Tracker supports **Linux and Windows**:
0 commit comments