1e41f4b71Sopenharmony_ci# top
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## 命令功能
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_citop命令用于查询进程及线程信息。
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## 命令格式
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_citop [_-a_]
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci## 参数说明
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**表1** 参数说明
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci| 参数   | 参数说明                    |
19e41f4b71Sopenharmony_ci| ------ | --------------------------- |
20e41f4b71Sopenharmony_ci| --help | 查看top命令支持的参数列表。 |
21e41f4b71Sopenharmony_ci| -a     | 显示更详细的信息。          |
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci## 使用指南
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci参数缺省时默认打印部分任务信息。
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci## 特殊说明
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_cishell端暂不支持。切换mksh版本可全支持,方法:cd bin; ./mksh。
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci## 使用实例
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci举例:输入top
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci## 输出说明
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci**示例1** top 命令显示详情
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci```
42e41f4b71Sopenharmony_ciOHOS:/$ top
43e41f4b71Sopenharmony_ci  allCpu(%):    4.68 sys,  195.32 idle
44e41f4b71Sopenharmony_ci  PID  PPID PGID       UID  Status VirtualMem ShareMem PhysicalMem CPUUSE10s  PName
45e41f4b71Sopenharmony_ci    1    -1    1         0 Pending   0x33b000  0xbb000     0x4e01c      0.0   init
46e41f4b71Sopenharmony_ci    2    -1    2         0 Pending   0xd838c0        0    0xd838c0      1.16  KProcess
47e41f4b71Sopenharmony_ci    3     1    3         7 Pending   0x72e000 0x1a3000    0x1d29dc      0.0   foundation
48e41f4b71Sopenharmony_ci    4     1    4         8 Pending   0x362000  0xbb000     0x5cc19      0.0   bundle_daemon
49e41f4b71Sopenharmony_ci    5     1    5         1 Pending   0xdfa000 0x2e7000    0x148a0a      0.0   appspawn
50e41f4b71Sopenharmony_ci    6     1    6         0 Pending   0x688000 0x137000    0x11c1ba      0.0   media_server
51e41f4b71Sopenharmony_ci    7     1    7         0 Pending   0x9d2000 0x103000     0xa21f9      0.87  wms_server
52e41f4b71Sopenharmony_ci    8     1    8         2 Pending   0x1f5000  0x48000     0x462dc      0.0   mksh
53e41f4b71Sopenharmony_ci   11     1   11         0 Pending   0x4d4000 0x112000     0xe0d9c      0.0   deviceauth_service
54e41f4b71Sopenharmony_ci   12     1   12         0 Pending   0x34f000  0xbd000     0x51cb3      0.0   sensor_service
55e41f4b71Sopenharmony_ci   13     1   13         2 Pending   0x34e000  0xb3000     0x5269e      0.0   ai_server
56e41f4b71Sopenharmony_ci   14     1   14         0 Pending   0x61f000 0x13b000    0x16858b      0.45  softbus_server
57e41f4b71Sopenharmony_ci   43     8   43         2 Running   0x1d7000  0x3a000     0x1e9f5      0.0   toybox
58e41f4b71Sopenharmony_ci  TID  PID Affi CPU       Status StackSize WaterLine CPUUSE10s    MEMUSE  TaskName
59e41f4b71Sopenharmony_ci   23    1  0x3  -1      Pending    0x3000     0xcf4      0.0           0  init
60e41f4b71Sopenharmony_ci    1    2  0x1  -1      Pending    0x4000     0x2c4      0.33          0  Swt_Task
61e41f4b71Sopenharmony_ci    2    2  0x3  -1      Pending    0x4000     0x204      0.0           0  system_wq
62e41f4b71Sopenharmony_ci    3    2  0x2  -1      Pending    0x4000     0x514      0.75          0  Swt_Task
63e41f4b71Sopenharmony_ci    4    2  0x3  -1      Pending    0x1000     0x3ac      0.0           0  ResourcesTask
64e41f4b71Sopenharmony_ci    7    2  0x3  -1      Pending    0x4e20     0xa5c      0.0           0  PlatformWorkerThread
65e41f4b71Sopenharmony_ci    8    2  0x3  -1      Pending    0x4e20     0xa6c      0.0           0  PlatformWorkerThread
66e41f4b71Sopenharmony_ci    9    2  0x3  -1      Pending    0x4e20     0xbf4      0.0           0  PlatformWorkerThread
67e41f4b71Sopenharmony_ci   10    2  0x3  -1      Pending    0x3000     0x4dc      0.0           0  bcache_async_task
68e41f4b71Sopenharmony_ci   11    2  0x3  -1     PendTime    0x4000     0x3e4      0.5           0  hi_vdec_thread
69e41f4b71Sopenharmony_ci   12    2  0x3  -1      Pending    0x2710     0x224      0.0           0  LiteOS usb pnp notify handle kt
70e41f4b71Sopenharmony_ci   13    2  0x3  -1      Pending    0x3000     0x37c      0.0           0  bcache_async_task
71e41f4b71Sopenharmony_ci   14    2  0x3  -1      Pending    0x4000     0x204      0.0           0  vibrator_queue
72e41f4b71Sopenharmony_ci   15    2  0x3  -1      Pending   0x20000     0x35c      0.0           0  eth_irq_Task
73e41f4b71Sopenharmony_ci   16    2  0x3  -1     PendTime    0x2000     0x354      0.0           0  MessageDispatcher
74e41f4b71Sopenharmony_ci   18    2  0x3  -1      Pending    0x2710     0x200      0.0           0  GPIO_IRQ_TSK_0_4
75e41f4b71Sopenharmony_ci   19    2  0x3  -1      Pending    0x4000     0x204      0.0           0  dispWQ
76e41f4b71Sopenharmony_ci   20    2  0x3  -1      Pending    0x4000     0x204      0.0           0  hdf_sensor_test_work_queue
77e41f4b71Sopenharmony_ci   21    2  0x3  -1     PendTime    0x6000     0x40c      0.2           0  tcpip_thread
78e41f4b71Sopenharmony_ci   22    2  0x3  -1      Pending    0x4000     0x36c      0.0           0  SendToSer
79e41f4b71Sopenharmony_ci   61    2  0x3  -1      Pending    0x4000     0x244      0.0           0  USB_GIANT_Task
80e41f4b71Sopenharmony_ci   63    2  0x3  -1      Pending    0x4000     0x244      0.0           0  USB_NGIAN_ISOC_Task
81e41f4b71Sopenharmony_ci   64    2  0x3  -1      Pending    0x4000     0x244      0.0           0  USB_NGIAN_BULK_TasK
82e41f4b71Sopenharmony_ci```
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci**表2** 输出元素说明
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci| 输出      | 说明              |
87e41f4b71Sopenharmony_ci| --------- | ----------------- |
88e41f4b71Sopenharmony_ci| PID       | 进程ID。          |
89e41f4b71Sopenharmony_ci| PPID      | 父进程ID。        |
90e41f4b71Sopenharmony_ci| PGID      | 进程组ID。        |
91e41f4b71Sopenharmony_ci| UID       | 用户ID。          |
92e41f4b71Sopenharmony_ci| Status    | 任务当前的状态。  |
93e41f4b71Sopenharmony_ci| CPUUSE10s | 10秒内CPU使用率。 |
94e41f4b71Sopenharmony_ci| PName     | 进程名。          |
95e41f4b71Sopenharmony_ci| TID       | 任务ID。          |
96e41f4b71Sopenharmony_ci| StackSize | 任务堆栈的大小。  |
97e41f4b71Sopenharmony_ci| WaterLine | 栈使用的峰值。    |
98e41f4b71Sopenharmony_ci| MEMUSE    | 内存使用量。      |
99e41f4b71Sopenharmony_ci| TaskName  | 任务名。          |