| ... | @@ -99,12 +99,20 @@ pub const ChildProcess = struct { | ... | @@ -99,12 +99,20 @@ pub const ChildProcess = struct { |
| 99 | return null; | 99 | return null; |
| 100 | } | 100 | } |
| 101 | }, | 101 | }, |
| | 102 | .windows => { |
| | 103 | if (rus.rusage) |ru| { |
| | 104 | return ru.PeakWorkingSetSize; |
| | 105 | } else { |
| | 106 | return null; |
| | 107 | } |
| | 108 | }, |
| 102 | else => return null, | 109 | else => return null, |
| 103 | } | 110 | } |
| 104 | } | 111 | } |
| 105 | | 112 | |
| 106 | const rusage_init = switch (builtin.os.tag) { | 113 | const rusage_init = switch (builtin.os.tag) { |
| 107 | .linux => @as(?std.os.rusage, null), | 114 | .linux => @as(?std.os.rusage, null), |
| | 115 | .windows => @as(?windows.PROCESS_MEMORY_COUNTERS, null), |
| 108 | else => {}, | 116 | else => {}, |
| 109 | }; | 117 | }; |
| 110 | }; | 118 | }; |
| ... | @@ -364,6 +372,13 @@ pub const ChildProcess = struct { | ... | @@ -364,6 +372,13 @@ pub const ChildProcess = struct { |
| 364 | } | 372 | } |
| 365 | }); | 373 | }); |
| 366 | | 374 | |
| | 375 | if (self.request_resource_usage_statistics) { |
| | 376 | var pmc: windows.PROCESS_MEMORY_COUNTERS = undefined; |
| | 377 | if (windows.kernel32.K32GetProcessMemoryInfo(self.id, &pmc, @sizeOf(windows.PROCESS_MEMORY_COUNTERS)) != 0) { |
| | 378 | self.resource_usage_statistics.rusage = pmc; |
| | 379 | } |
| | 380 | } |
| | 381 | |
| 367 | os.close(self.id); | 382 | os.close(self.id); |
| 368 | os.close(self.thread_handle); | 383 | os.close(self.thread_handle); |
| 369 | self.cleanupStreams(); | 384 | self.cleanupStreams(); |