如何访问 Windows Bash 中的资源使用

How can I access resource use in Windows Bash

我正在尝试了解 wsl/lxss 作为开发环境是否有用,我需要的其中一件事是获取我的程序的资源使用详细信息。

然而,无论我怎么尝试,Windows 似乎都没有正确报告资源使用情况:

~$ sudo ps axo pid,comm,size,rss,%cpu,%mem
  PID COMMAND          SIZE   RSS %CPU %MEM
    1 init                0     0  0.0  0.0
20654 bash                0     0  0.0  0.0
23785 bash                0     0  0.0  0.0
27560 bash                0     0  0.0  0.0
29868 sudo                0     0  0.0  0.0
29869 apt                 0     0  0.0  0.0
31299 dpkg                0     0  0.0  0.0
31351 ca-certificates     0     0  0.0  0.0
31380 ca-certificates     0     0  0.0  0.0
31381 java                0     0  0.0  0.0
31969 sudo                0     0  0.0  0.0
31978 ca-ce <defunct>     0     0  0.0  0.0
31979 ps                  0     0  0.0  0.0

(我当时实际上是在安装openjdk-7-jre-headless,所以应该有更明显的东西)

~$ sudo htop

  1  [||||||||||||||||||||||||||                    50.2%]     Tasks: 6, 0 thr; 1 running
  2  [|||||||||||||||||||||||||||                   51.0%]     Load average: 0.52 0.58 0.59
  3  [|||||||||||||||||||||||||||                   50.7%]     Uptime: 1 day, 04:09:15
  4  [|||||||||||||||||||||||||||                   51.2%]
  Mem[||||||||||||||||||||||||||||||||||      4768/7879MB]
  Swp[|                                       156/21539MB]

  PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
  278 root       20   0     0     0     0 R  0.0  0.0  0:00.03 htop
    1 root       20   0     0     0     0 S  0.0  0.0  0:00.03 /init
20654 edward     20   0     0     0     0 S  0.0  0.0  0:55.46 /bin/bash
23785 edward     20   0     0     0     0 S  0.0  0.0  0:13.41 /bin/bash
27560 edward     20   0     0     0     0 S  0.0  0.0  0:00.11 /bin/bash
  277 root       20   0     0     0     0 S  0.0  0.0  0:00.03 sudo htop

(当时安装结束,Windows 报告 6% CPU 负载)

是我做错了什么,还是系统调用还没有实现?

在 Windows 10 Creators Update 的 Bash/WSL Insider build and/or 中,现在应该可以更准确地报告进程统计信息。