1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

add idle status for newer top version support

This commit is contained in:
Kelly Brazil
2022-05-27 16:27:51 -07:00
parent 2cd14235c8
commit 8240626043
7 changed files with 280 additions and 0 deletions

View File

@ -394,6 +394,7 @@ def _process(proc_data: List[Dict], quiet=False) -> List[Dict]:
status_map: Dict = {
'D': 'uninterruptible sleep',
'I': 'idle',
'R': 'running',
'S': 'sleeping',
'T': 'stopped by job control signal',

View File

@ -231,6 +231,7 @@ def _process(proc_data: Dict, idx=0, quiet=False) -> Dict:
status_map: Dict = {
'D': 'uninterruptible sleep',
'I': 'idle',
'R': 'running',
'S': 'sleeping',
'T': 'stopped by job control signal',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

252
tests/fixtures/ubuntu-20.10/top-b-n1.out vendored Normal file
View File

@ -0,0 +1,252 @@
top - 23:06:21 up 2 min, 2 users, load average: 0.55, 0.24, 0.09
Tasks: 245 total, 1 running, 244 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.1 us, 3.1 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3903.6 total, 2378.7 free, 320.2 used, 1204.7 buff/cache
MiB Swap: 3903.0 total, 3903.0 free, 0.0 used. 3345.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 104364 13208 8636 S 0.0 0.3 0:06.01 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
5 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0-cgroup_destroy
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-kblockd
7 root 20 0 0 0 0 I 0.0 0.0 0:00.03 kworker/0:1-events
8 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:0-events_freezable_power_
9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
10 root 20 0 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/0
11 root 20 0 0 0 0 I 0.0 0.0 0:00.19 rcu_sched
12 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
13 root -51 0 0 0 0 S 0.0 0.0 0:00.00 idle_inject/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
16 root -51 0 0 0 0 S 0.0 0.0 0:00.00 idle_inject/1
17 root rt 0 0 0 0 S 0.0 0.0 0:01.30 migration/1
18 root 20 0 0 0 0 S 0.0 0.0 0:00.41 ksoftirqd/1
19 root 20 0 0 0 0 I 0.0 0.0 0:00.03 kworker/1:0-events
20 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/1:0H-kblockd
21 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
22 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns
23 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_kthre
24 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_rude_
25 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_trace
26 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd
27 root 20 0 0 0 0 I 0.0 0.0 0:00.11 kworker/0:2-events
28 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
29 root 20 0 0 0 0 S 0.0 0.0 0:00.00 oom_reaper
30 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 writeback
31 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kcompactd0
32 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
33 root 39 19 0 0 0 S 0.0 0.0 0:00.00 khugepaged
38 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/1:1-events
80 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kintegrityd
81 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kblockd
82 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 blkcg_punt_bio
83 root 20 0 0 0 0 I 0.0 0.0 0:00.27 kworker/1:2-events
84 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 tpm_dev_wq
85 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 ata_sff
86 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 md
87 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 edac-poller
88 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 devfreq_wq
89 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdogd
90 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:1-events_unbound
91 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 pm_wq
93 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kswapd0
94 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ecryptfs-kthrea
96 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kthrotld
97 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/24-pciehp
98 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/25-pciehp
99 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/26-pciehp
100 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/27-pciehp
101 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/28-pciehp
102 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/29-pciehp
103 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/30-pciehp
104 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/31-pciehp
105 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/32-pciehp
106 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/33-pciehp
107 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/34-pciehp
108 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/35-pciehp
109 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/36-pciehp
110 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/37-pciehp
111 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/38-pciehp
112 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/39-pciehp
113 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/40-pciehp
114 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/41-pciehp
115 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/42-pciehp
116 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/43-pciehp
117 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/44-pciehp
118 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/45-pciehp
119 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/46-pciehp
120 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/47-pciehp
121 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/48-pciehp
122 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/49-pciehp
123 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/50-pciehp
124 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/51-pciehp
125 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/52-pciehp
126 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/53-pciehp
127 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/54-pciehp
128 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/55-pciehp
129 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 acpi_thermal_pm
130 root 20 0 0 0 0 S 0.0 0.0 0:00.01 scsi_eh_0
131 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_0
132 root 20 0 0 0 0 S 0.0 0.0 0:00.01 scsi_eh_1
133 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_1
134 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:2-events_unbound
135 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 vfio-irqfd-clea
136 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 ipv6_addrconf
137 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:3-events_unbound
146 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kstrp
149 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 zswap-shrink
150 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/u257:0-hci0
155 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 charger_manager
159 root 20 0 0 0 0 I 0.0 0.0 0:00.12 kworker/0:3-events
200 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mpt_poll_0
201 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mpt/0
202 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2
203 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_2
204 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_3
205 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_3
206 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_4
207 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_4
208 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_5
209 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_5
210 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_6
211 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_6
212 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_7
213 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_7
214 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_8
215 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_8
216 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_9
217 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_9
218 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_10
219 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_10
220 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_11
221 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_11
222 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_12
223 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_12
224 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_13
225 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_13
226 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_14
227 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_14
228 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_15
229 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_15
230 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_16
231 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_16
232 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_17
233 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_17
234 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_18
235 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_18
236 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_19
237 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_19
238 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_20
239 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_20
240 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_21
241 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_21
242 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_22
243 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_22
244 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_23
245 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_23
246 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_24
247 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_24
248 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_25
249 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_25
250 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_26
251 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_26
252 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_27
253 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_27
254 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_28
255 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_28
256 root 20 0 0 0 0 S 0.0 0.0 0:00.01 scsi_eh_29
257 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_29
258 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_30
259 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_30
260 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_31
261 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_31
262 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:4-events_unbound
263 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:5-events_unbound
264 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 cryptd
265 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:6-events_unbound
266 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:7-events_unbound
267 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:8-events_unbound
268 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:9-events_unbound
269 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:10-events_unbound
270 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:11-events_unbound
278 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:12-events_unbound
280 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:13-events_power_efficient
281 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:14-events_unbound
282 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:15-events_unbound
285 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:16-events_unbound
289 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:17-events_unbound
291 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:18-events_unbound
293 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:19-events_unbound
296 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:20-events_unbound
297 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:21-events_unbound
298 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:22-events_unbound
299 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:23-events_unbound
301 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:24-events_unbound
302 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:25-events_unbound
304 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:26-events_unbound
305 root 20 0 0 0 0 I 0.0 0.0 0:00.07 kworker/u256:27-events_power_efficient
307 root 20 0 0 0 0 I 0.0 0.0 0:00.04 kworker/u256:28-events_unbound
308 root 20 0 0 0 0 I 0.0 0.0 0:00.15 kworker/u256:29-events_unbound
309 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:30-events_power_efficient
313 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/16-vmwgfx
315 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 ttm_swap
325 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/u256:31
326 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_32
327 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 scsi_tmf_32
328 root 0 -20 0 0 0 I 0.0 0.0 0:00.08 kworker/1:1H-kblockd
337 root 0 -20 0 0 0 I 0.0 0.0 0:00.07 kworker/0:1H-kblockd
350 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kdmflush
376 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 raid5wq
420 root 20 0 0 0 0 S 0.0 0.0 0:00.10 jbd2/dm-0-8
421 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 ext4-rsv-conver
492 root 19 -1 60836 16072 14860 S 0.0 0.4 0:00.35 systemd-journal
513 root 20 0 0 0 0 I 0.0 0.0 0:00.03 kworker/1:3-events
521 root 20 0 22372 5520 4044 S 0.0 0.1 0:00.21 systemd-udevd
561 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/u257:1-hci0
562 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/u257:2-hci0
696 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kaluad
697 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kmpath_rdacd
698 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kmpathd
699 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kmpath_handlerd
700 root rt 0 346612 18828 9032 S 0.0 0.5 0:00.08 multipathd
710 root 20 0 0 0 0 S 0.0 0.0 0:00.00 jbd2/sda2-8
711 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 ext4-rsv-conver
719 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 loop1
720 root 0 -20 0 0 0 S 0.0 0.0 0:00.01 loop2
723 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 loop5
726 root 0 -20 0 0 0 S 0.0 0.0 0:00.06 loop6
743 systemd+ 20 0 91388 6576 5692 S 0.0 0.2 0:00.07 systemd-timesyn
753 root 20 0 47920 10484 9052 S 0.0 0.3 0:00.02 VGAuthService
754 root 20 0 164312 7544 6532 S 0.0 0.2 0:00.23 vmtoolsd
828 systemd+ 20 0 28020 8016 7024 S 0.0 0.2 0:00.06 systemd-network
830 systemd+ 20 0 25108 12452 8392 S 0.0 0.3 0:00.09 systemd-resolve
844 root 20 0 236544 7676 6744 S 0.0 0.2 0:00.05 accounts-daemon
847 root 20 0 6800 2832 2628 S 0.0 0.1 0:00.00 cron
848 message+ 20 0 8532 4924 4260 S 0.0 0.1 0:00.26 dbus-daemon
854 root 20 0 82856 3852 3544 S 0.0 0.1 0:00.01 irqbalance
857 root 20 0 29748 17980 10328 S 0.0 0.4 0:00.07 networkd-dispat
859 syslog 20 0 221128 5336 4028 S 0.0 0.1 0:00.03 rsyslogd
865 root 20 0 18268 7916 6908 S 0.0 0.2 0:00.15 systemd-logind
869 daemon 20 0 3776 2096 1920 S 0.0 0.1 0:00.00 atd
888 root 20 0 5956 3884 3096 S 0.0 0.1 0:00.01 login
897 root 20 0 13084 6892 6036 S 0.0 0.2 0:00.00 sshd
898 root 20 0 0 0 0 D 0.0 0.0 0:00.37 kworker/0:4+usb_hub_wq
911 root 20 0 107916 20632 12984 S 0.0 0.5 0:00.07 unattended-upgr
912 root 20 0 233596 6868 6172 S 0.0 0.2 0:00.01 polkitd
932 root 20 0 0 0 0 I 0.0 0.0 0:00.02 kworker/1:4-events
1198 kbrazil 20 0 19744 10168 8460 S 0.0 0.3 0:00.10 systemd
1199 kbrazil 20 0 104452 3608 16 S 0.0 0.1 0:00.00 (sd-pam)
1205 kbrazil 20 0 8292 5220 3468 S 0.0 0.1 0:00.02 bash
1318 root 0 -20 0 0 0 S 0.0 0.0 0:00.01 loop7
1347 root 20 0 948032 49776 19700 S 0.0 1.2 0:07.23 snapd
1505 root 20 0 14840 8944 7480 S 0.0 0.2 0:00.01 sshd
1579 kbrazil 20 0 14840 6084 4596 S 0.0 0.2 0:00.08 sshd
1580 kbrazil 20 0 8416 5464 3616 S 0.0 0.1 0:00.04 bash
1687 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 loop8
1822 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 loop0
1874 kbrazil 20 0 7968 4008 3648 S 0.0 0.1 0:00.00 dbus-daemon
1968 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 loop3
2029 root 20 0 283752 16228 14168 S 0.0 0.4 0:00.01 packagekitd
2538 kbrazil 20 0 10116 4016 3300 R 0.0 0.1 0:00.01 top

View File

@ -19,6 +19,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n1-gib-allfields-w.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n1_gib_allfields_w = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.10/top-b-n1.out'), 'r', encoding='utf-8') as f:
self.ubuntu_20_10_top_b_n1 = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n3.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n3_json = json.loads(f.read())
@ -29,6 +32,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n1-gib-allfields-w.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n1_gib_allfields_w_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.10/top-b-n1.json'), 'r', encoding='utf-8') as f:
self.ubuntu_20_10_top_b_n1_json = json.loads(f.read())
def test_top_nodata(self):
"""
@ -54,6 +60,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.top.parse(self.centos_7_7_top_b_n1_gib_allfields_w, quiet=True), self.centos_7_7_top_b_n1_gib_allfields_w_json)
def test_top_ubuntu_20_10(self):
"""
Test 'top -b -n 1' with units as MiB on Ubuntu 20.10
"""
self.assertEqual(jc.parsers.top.parse(self.ubuntu_20_10_top_b_n1, quiet=True), self.ubuntu_20_10_top_b_n1_json)
if __name__ == '__main__':
unittest.main()

View File

@ -22,6 +22,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n1-gib-allfields-w.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n1_gib_allfields_w = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.10/top-b-n1.out'), 'r', encoding='utf-8') as f:
self.ubuntu_20_10_top_b_n1 = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n3-streaming.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n3_streaming_json = json.loads(f.read())
@ -32,6 +35,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/top-b-n1-gib-allfields-w-streaming.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_top_b_n1_gib_allfields_w_streaming_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.10/top-b-n1-streaming.json'), 'r', encoding='utf-8') as f:
self.ubuntu_20_10_top_b_n1_streaming_json = json.loads(f.read())
def test_top_s_nodata(self):
"""
Test 'top' with no data
@ -56,6 +62,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(list(jc.parsers.top_s.parse(self.centos_7_7_top_b_n1_gib_allfields_w.splitlines(), quiet=True)), self.centos_7_7_top_b_n1_gib_allfields_w_streaming_json)
def test_top_s_b_n1_ubuntu_20_10(self):
"""
Test 'top -b -n1' with MiB units on Ubuntu 20.10
"""
self.assertEqual(list(jc.parsers.top_s.parse(self.ubuntu_20_10_top_b_n1.splitlines(), quiet=True)), self.ubuntu_20_10_top_b_n1_streaming_json)
if __name__ == '__main__':
unittest.main()