From 3389eb5debe0f0ba01ece01e20048608bf357e70 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 9 Mar 2022 13:18:04 -0800 Subject: [PATCH] initial working parser --- jc/parsers/pidstat.py | 52 ++++++++++-- .../centos-7.7/pidstat-hdlrsuw-2-5.out | 47 +++++++++++ tests/fixtures/centos-7.7/pidstat-hdlrsuw.out | 83 +++++++++++++++++++ tests/fixtures/centos-7.7/pidstat-hl.out | 46 ++++++++++ 4 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 tests/fixtures/centos-7.7/pidstat-hdlrsuw-2-5.out create mode 100644 tests/fixtures/centos-7.7/pidstat-hdlrsuw.out create mode 100644 tests/fixtures/centos-7.7/pidstat-hl.out diff --git a/jc/parsers/pidstat.py b/jc/parsers/pidstat.py index 5c808614..22e7b6f4 100644 --- a/jc/parsers/pidstat.py +++ b/jc/parsers/pidstat.py @@ -1,6 +1,6 @@ """jc - JSON Convert `pidstat` command output parser -<> +Must use the `-h` option in `pidstat`. Usage (cli): @@ -24,9 +24,27 @@ Schema: [ { - "pidstat": string, - "bar": boolean, - "baz": integer + "time": "1646857494", + "uid": "1000", + "pid": "2201", + "percent_usr": "0.00", + "percent_system": "0.00", + "percent_guest": "0.00", + "percent_cpu": "0.00", + "cpu": "0", + "minflt_s": "0.09", + "majflt_s": "0.00", + "vsz": "108328", + "rss": "1040", + "percent_mem": "0.03", + "stksize": "132", + "stkref": "20", + "kb_rd_s": "0.00", + "kb_wr_s": "0.00", + "kb_ccwr_s": "0.00", + "cswch_s": "0.00", + "nvcswch_s": "0.00", + "command": "pidstat -dlrsuwh" } ] @@ -40,6 +58,8 @@ Examples: """ from typing import List, Dict import jc.utils +from jc.parsers.universal import simple_table_parse +from jc.exceptions import ParseError class info(): @@ -101,12 +121,26 @@ def parse( if jc.utils.has_data(data): - for line in filter(None, data.splitlines()): + # check for line starting with # as the start of the table + data_list = list(filter(None, data.splitlines())) + for line in data_list.copy(): + if line.startswith('#'): + break + else: + data_list.pop(0) - # parse the content here - # check out helper functions in jc.utils - # and jc.parsers.universal + if not data_list: + raise ParseError('Could not parse pidstat output. Make sure to use "pidstat -h".') - pass + # normalize headers + data_list[0] = data_list[0].replace('#', ' ')\ + .replace('/', '_')\ + .replace('%', 'percent_')\ + .lower() + + # remove remaining header lines (e.g. pidstat -h 2 5) + data_list = [i for i in data_list if not i.startswith('#')] + + raw_output = simple_table_parse(data_list) return raw_output if raw else _process(raw_output) diff --git a/tests/fixtures/centos-7.7/pidstat-hdlrsuw-2-5.out b/tests/fixtures/centos-7.7/pidstat-hdlrsuw-2-5.out new file mode 100644 index 00000000..5096001a --- /dev/null +++ b/tests/fixtures/centos-7.7/pidstat-hdlrsuw-2-5.out @@ -0,0 +1,47 @@ +Linux 3.10.0-1062.1.2.el7.x86_64 (localhost) 03/09/2022 _x86_64_ (1 CPU) + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646859221 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.49 0.00 ksoftirqd/0 + 1646859221 0 9 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.98 0.00 rcu_sched + 1646859221 0 11 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 watchdog/0 + 1646859221 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.99 0.00 kworker/u256:4 + 1646859221 0 466 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:1H + 1646859221 0 2232 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 2.97 0.00 kworker/0:1 + 1646859221 0 2263 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:0 + 1646859221 1000 2297 0.00 0.50 0.00 0.50 0 74.75 0.00 108296 1072 0.03 132 20 0.00 0.00 0.00 0.50 0.50 pidstat -dlrsuwh 2 5 + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646859223 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 ksoftirqd/0 + 1646859223 0 9 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 2.00 0.00 rcu_sched + 1646859223 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 kworker/u256:4 + 1646859223 0 2232 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 3.00 0.00 kworker/0:1 + 1646859223 0 2263 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:0 + 1646859223 1000 2297 0.50 0.50 0.00 1.00 0 82.50 0.00 108296 1152 0.03 132 24 0.00 0.00 0.00 0.50 0.50 pidstat -dlrsuwh 2 5 + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646859225 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.01 0.00 ksoftirqd/0 + 1646859225 0 9 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 2.02 0.00 rcu_sched + 1646859225 0 11 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.51 0.00 watchdog/0 + 1646859225 0 32 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.51 0.00 khugepaged + 1646859225 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.01 0.00 kworker/u256:4 + 1646859225 0 2232 0.00 0.51 0.00 0.51 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 3.03 0.00 kworker/0:1 + 1646859225 0 2263 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.51 0.00 kworker/0:0 + 1646859225 1000 2297 0.00 0.00 0.00 0.00 0 73.23 0.00 108296 1152 0.03 132 24 0.00 0.00 0.00 0.51 0.51 pidstat -dlrsuwh 2 5 + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646859227 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 ksoftirqd/0 + 1646859227 0 9 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 2.00 0.00 rcu_sched + 1646859227 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 kworker/u256:4 + 1646859227 0 2232 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 3.00 0.00 kworker/0:1 + 1646859227 0 2263 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:0 + 1646859227 1000 2297 0.50 0.50 0.00 1.00 0 72.50 0.00 108296 1152 0.03 132 24 0.00 0.00 0.00 0.50 0.50 pidstat -dlrsuwh 2 5 + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646859229 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 ksoftirqd/0 + 1646859229 0 9 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 3.48 0.00 rcu_sched + 1646859229 0 11 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 watchdog/0 + 1646859229 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 1.00 0.00 kworker/u256:4 + 1646859229 0 466 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:1H + 1646859229 0 2232 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 2.99 0.00 kworker/0:1 + 1646859229 0 2263 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.50 0.00 kworker/0:0 + 1646859229 1000 2297 0.00 0.50 0.00 0.50 0 72.14 0.00 108296 1152 0.03 132 24 0.00 0.00 0.00 0.50 0.00 pidstat -dlrsuwh 2 5 diff --git a/tests/fixtures/centos-7.7/pidstat-hdlrsuw.out b/tests/fixtures/centos-7.7/pidstat-hdlrsuw.out new file mode 100644 index 00000000..ddbd6c27 --- /dev/null +++ b/tests/fixtures/centos-7.7/pidstat-hdlrsuw.out @@ -0,0 +1,83 @@ +Linux 3.10.0-1062.1.2.el7.x86_64 (localhost) 03/09/2022 _x86_64_ (1 CPU) + +# Time UID PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM StkSize StkRef kB_rd/s kB_wr/s kB_ccwr/s cswch/s nvcswch/s Command + 1646857494 0 2 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.03 0.00 kthreadd + 1646857494 0 4 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kworker/0:0H + 1646857494 0 6 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.77 0.00 ksoftirqd/0 + 1646857494 0 7 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.48 0.00 migration/0 + 1646857494 0 8 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 rcu_bh + 1646857494 0 9 0.00 0.01 0.00 0.01 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 4.93 0.00 rcu_sched + 1646857494 0 10 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 lru-add-drain + 1646857494 0 11 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.25 0.00 watchdog/0 + 1646857494 0 13 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.03 0.00 kdevtmpfs + 1646857494 0 14 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 netns + 1646857494 0 15 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.01 0.00 khungtaskd + 1646857494 0 16 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 writeback + 1646857494 0 17 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kintegrityd + 1646857494 0 18 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 19 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 20 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 21 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kblockd + 1646857494 0 22 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 md + 1646857494 0 23 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 edac-poller + 1646857494 0 24 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 watchdogd + 1646857494 0 30 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kswapd0 + 1646857494 0 31 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 ksmd + 1646857494 0 32 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.10 0.00 khugepaged + 1646857494 0 33 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 crypto + 1646857494 0 41 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kthrotld + 1646857494 0 43 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kmpath_rdacd + 1646857494 0 44 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kaluad + 1646857494 0 45 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kpsmoused + 1646857494 0 47 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 ipv6_addrconf + 1646857494 0 60 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 deferwq + 1646857494 0 95 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.09 0.00 kauditd + 1646857494 0 272 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 mpt_poll_0 + 1646857494 0 273 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 mpt/0 + 1646857494 0 274 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 nfit + 1646857494 0 275 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 ata_sff + 1646857494 0 285 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 scsi_eh_0 + 1646857494 0 288 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 scsi_tmf_0 + 1646857494 0 308 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 scsi_eh_1 + 1646857494 0 309 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.88 0.00 kworker/u256:2 + 1646857494 0 314 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 scsi_tmf_1 + 1646857494 0 319 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.01 0.00 scsi_eh_2 + 1646857494 0 323 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 scsi_tmf_2 + 1646857494 0 356 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.19 0.00 kworker/u256:4 + 1646857494 0 357 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.63 0.00 irq/16-vmwgfx + 1646857494 0 359 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 ttm_swap + 1646857494 0 431 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kdmflush + 1646857494 0 432 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 441 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kdmflush + 1646857494 0 442 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 455 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 bioset + 1646857494 0 456 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfsalloc + 1646857494 0 457 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs_mru_cache + 1646857494 0 458 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-buf/dm-0 + 1646857494 0 459 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-data/dm-0 + 1646857494 0 460 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-conv/dm-0 + 1646857494 0 461 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-cil/dm-0 + 1646857494 0 462 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-reclaim/dm- + 1646857494 0 463 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-log/dm-0 + 1646857494 0 464 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-eofblocks/d + 1646857494 0 465 0.00 0.01 0.00 0.01 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 3.04 0.00 xfsaild/dm-0 + 1646857494 0 466 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.20 0.00 kworker/0:1H + 1646857494 0 698 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 kworker/u257:0 + 1646857494 0 700 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 hci0 + 1646857494 0 701 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 hci0 + 1646857494 0 702 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.01 0.00 kworker/u257:1 + 1646857494 0 725 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-buf/sda1 + 1646857494 0 726 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-data/sda1 + 1646857494 0 727 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-conv/sda1 + 1646857494 0 728 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-cil/sda1 + 1646857494 0 729 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-reclaim/sda + 1646857494 0 730 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-log/sda1 + 1646857494 0 731 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfs-eofblocks/s + 1646857494 0 732 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.00 0.00 xfsaild/sda1 + 1646857494 1000 1852 0.00 0.00 0.00 0.00 0 0.25 0.00 115708 2324 0.06 264 264 0.08 0.00 0.00 0.01 0.00 -bash + 1646857494 1000 1877 0.00 0.00 0.00 0.00 0 0.33 0.00 115580 2216 0.06 132 24 0.64 0.00 0.00 0.03 0.00 -bash + 1646857494 0 2062 0.00 0.03 0.00 0.03 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.95 0.00 kworker/0:0 + 1646857494 0 2153 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.03 0.00 kworker/0:1 + 1646857494 0 2199 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 0 0 -1.00 -1.00 -1.00 0.03 0.00 kworker/0:2 + 1646857494 1000 2201 0.00 0.00 0.00 0.00 0 0.09 0.00 108328 1040 0.03 132 20 0.00 0.00 0.00 0.00 0.00 pidstat -dlrsuwh + diff --git a/tests/fixtures/centos-7.7/pidstat-hl.out b/tests/fixtures/centos-7.7/pidstat-hl.out new file mode 100644 index 00000000..b8924bbf --- /dev/null +++ b/tests/fixtures/centos-7.7/pidstat-hl.out @@ -0,0 +1,46 @@ +Linux 3.10.0-1062.1.2.el7.x86_64 (localhost) 03/09/2022 _x86_64_ (1 CPU) + +# Time UID PID %usr %system %guest %CPU CPU Command + 1646859134 0 1 0.00 0.03 0.00 0.03 0 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 1646859134 0 6 0.00 0.00 0.00 0.00 0 ksoftirqd/0 + 1646859134 0 9 0.00 0.01 0.00 0.01 0 rcu_sched + 1646859134 0 11 0.00 0.00 0.00 0.00 0 watchdog/0 + 1646859134 0 32 0.00 0.00 0.00 0.00 0 khugepaged + 1646859134 0 308 0.00 0.00 0.00 0.00 0 scsi_eh_1 + 1646859134 0 309 0.00 0.00 0.00 0.00 0 kworker/u256:2 + 1646859134 0 319 0.00 0.00 0.00 0.00 0 scsi_eh_2 + 1646859134 0 356 0.00 0.00 0.00 0.00 0 kworker/u256:4 + 1646859134 0 357 0.00 0.00 0.00 0.00 0 irq/16-vmwgfx + 1646859134 0 465 0.00 0.01 0.00 0.01 0 xfsaild/dm-0 + 1646859134 0 466 0.00 0.00 0.00 0.00 0 kworker/0:1H + 1646859134 0 543 0.00 0.00 0.00 0.00 0 /usr/lib/systemd/systemd-journald + 1646859134 0 564 0.00 0.00 0.00 0.00 0 /usr/sbin/lvmetad -f + 1646859134 0 577 0.00 0.00 0.00 0.00 0 /usr/lib/systemd/systemd-udevd + 1646859134 0 752 0.00 0.00 0.00 0.00 0 /sbin/auditd + 1646859134 0 779 0.00 0.00 0.00 0.00 0 /usr/libexec/bluetooth/bluetoothd + 1646859134 999 780 0.00 0.00 0.00 0.00 0 /usr/lib/polkit-1/polkitd --no-debug + 1646859134 0 782 0.00 0.00 0.00 0.00 0 /usr/sbin/smartd -n -q never + 1646859134 0 784 0.00 0.00 0.00 0.00 0 /usr/lib/systemd/systemd-logind + 1646859134 81 787 0.00 0.00 0.00 0.00 0 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation + 1646859134 998 790 0.00 0.00 0.00 0.00 0 /usr/sbin/chronyd + 1646859134 0 834 0.00 0.01 0.00 0.01 0 /usr/sbin/crond -n + 1646859134 0 847 0.01 0.00 0.00 0.01 0 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid + 1646859134 0 849 0.00 0.00 0.00 0.00 0 /sbin/agetty --keep-baud 115200,38400,9600 ttyS0 vt220 + 1646859134 0 852 0.00 0.00 0.00 0.00 0 login -- kbrazil + 1646859134 0 882 0.00 0.00 0.00 0.00 0 /usr/sbin/NetworkManager --no-daemon + 1646859134 0 1031 0.00 0.00 0.00 0.00 0 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens33.pid -lf /var/lib/NetworkManager/dhclient-d92ec + 1646859134 0 1220 0.00 0.00 0.00 0.00 0 /usr/sbin/sshd -D + 1646859134 0 1221 0.06 0.03 0.00 0.09 0 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec + 1646859134 0 1222 0.01 0.00 0.00 0.01 0 /usr/bin/python2 -Es /usr/sbin/tuned -l -P + 1646859134 0 1225 0.00 0.00 0.00 0.01 0 /usr/sbin/rsyslogd -n + 1646859134 0 1293 0.04 0.02 0.00 0.05 0 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start- + 1646859134 0 1496 0.00 0.00 0.00 0.00 0 /usr/libexec/postfix/master -w + 1646859134 89 1512 0.00 0.00 0.00 0.00 0 qmgr -l -t unix -u + 1646859134 1000 1852 0.00 0.00 0.00 0.00 0 -bash + 1646859134 0 1872 0.00 0.00 0.00 0.00 0 sshd: kbrazil [priv] + 1646859134 1000 1876 0.00 0.00 0.00 0.00 0 sshd: kbrazil@pts/0 + 1646859134 1000 1877 0.00 0.00 0.00 0.00 0 -bash + 1646859134 0 2232 0.00 0.01 0.00 0.01 0 kworker/0:1 + 1646859134 0 2239 0.00 0.00 0.00 0.00 0 kworker/0:3 + 1646859134 89 2240 0.00 0.00 0.00 0.00 0 pickup -l -t unix -u + 1646859134 0 2263 0.00 0.00 0.00 0.00 0 kworker/0:0