mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 02:38:31 +00:00
Add i/o statistics to wait4() about child process
This commit is contained in:
parent
b9eb656e41
commit
58ef4e6df8
6 changed files with 39 additions and 8 deletions
|
@ -16,19 +16,17 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/sig.internal.h"
|
||||
#include "libc/calls/state.internal.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
#include "libc/calls/struct/rusage.internal.h"
|
||||
#include "libc/calls/syscall_support-nt.internal.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/nt/accounting.h"
|
||||
#include "libc/nt/process.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/nt/struct/filetime.h"
|
||||
#include "libc/nt/struct/iocounters.h"
|
||||
#include "libc/nt/struct/processmemorycounters.h"
|
||||
#include "libc/nt/thread.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/rusage.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "libc/nt/process.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/nt/struct/filetime.h"
|
||||
#include "libc/nt/struct/iocounters.h"
|
||||
#include "libc/nt/struct/processentry32.h"
|
||||
#include "libc/nt/struct/processmemorycounters.h"
|
||||
#include "libc/nt/synchronization.h"
|
||||
|
@ -68,6 +69,13 @@ static textwindows void AddProcessStats(int64_t h, struct rusage *ru) {
|
|||
} else {
|
||||
STRACE("%s failed %u", "GetProcessTimes", GetLastError());
|
||||
}
|
||||
struct NtIoCounters iocount;
|
||||
if (GetProcessIoCounters(h, &iocount)) {
|
||||
ru->ru_inblock += iocount.ReadOperationCount;
|
||||
ru->ru_oublock += iocount.WriteOperationCount;
|
||||
} else {
|
||||
STRACE("%s failed %u", "GetProcessIoCounters", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
static textwindows int sys_wait4_nt_impl(int *pid, int *opt_out_wstatus,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue