mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
doc formatting
This commit is contained in:
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
jc - JSON Convert `pidstat` command output streaming parser
|
jc - JSON Convert `pidstat` command output streaming parser
|
||||||
|
|
||||||
> This streaming parser outputs JSON Lines
|
> This streaming parser outputs JSON Lines (cli) or returns a Generator
|
||||||
|
iterator of Dictionaries (module)
|
||||||
|
|
||||||
Must use the `-h` option in `pidstat`. All other `pidstat` options are
|
Must use the `-h` option in `pidstat`. All other `pidstat` options are
|
||||||
supported in combination with `-h`.
|
supported in combination with `-h`.
|
||||||
@ -17,19 +18,11 @@ Usage (cli):
|
|||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
# result is an iterable object (generator)
|
|
||||||
result = jc.parse('pidstat_s', pidstat_command_output.splitlines())
|
result = jc.parse('pidstat_s', pidstat_command_output.splitlines())
|
||||||
for item in result:
|
for item in result:
|
||||||
# do something
|
# do something
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
import jc.parsers.pidstat_s
|
|
||||||
# result is an iterable object (generator)
|
|
||||||
result = jc.parsers.pidstat_s.parse(pidstat_command_output.splitlines())
|
|
||||||
for item in result:
|
|
||||||
# do something
|
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -66,9 +59,9 @@ Schema:
|
|||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ pidstat -hl | jc --pidstat-s
|
$ pidstat -hl | jc --pidstat-s
|
||||||
{"time":1646859134,"uid":0,"pid":1,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":1,"percent_usr":0.0,"percent_syste...}
|
||||||
{"time":1646859134,"uid":0,"pid":6,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":6,"percent_usr":0.0,"percent_syste...}
|
||||||
{"time":1646859134,"uid":0,"pid":9,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":9,"percent_usr":0.0,"percent_syste...}
|
||||||
...
|
...
|
||||||
|
|
||||||
$ pidstat -hl | jc --pidstat-s -r
|
$ pidstat -hl | jc --pidstat-s -r
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""jc - JSON Convert `pidstat` command output streaming parser
|
"""jc - JSON Convert `pidstat` command output streaming parser
|
||||||
|
|
||||||
> This streaming parser outputs JSON Lines
|
> This streaming parser outputs JSON Lines (cli) or returns a Generator
|
||||||
|
iterator of Dictionaries (module)
|
||||||
|
|
||||||
Must use the `-h` option in `pidstat`. All other `pidstat` options are
|
Must use the `-h` option in `pidstat`. All other `pidstat` options are
|
||||||
supported in combination with `-h`.
|
supported in combination with `-h`.
|
||||||
@ -12,19 +13,11 @@ Usage (cli):
|
|||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
# result is an iterable object (generator)
|
|
||||||
result = jc.parse('pidstat_s', pidstat_command_output.splitlines())
|
result = jc.parse('pidstat_s', pidstat_command_output.splitlines())
|
||||||
for item in result:
|
for item in result:
|
||||||
# do something
|
# do something
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
import jc.parsers.pidstat_s
|
|
||||||
# result is an iterable object (generator)
|
|
||||||
result = jc.parsers.pidstat_s.parse(pidstat_command_output.splitlines())
|
|
||||||
for item in result:
|
|
||||||
# do something
|
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -61,9 +54,9 @@ Schema:
|
|||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ pidstat -hl | jc --pidstat-s
|
$ pidstat -hl | jc --pidstat-s
|
||||||
{"time":1646859134,"uid":0,"pid":1,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":1,"percent_usr":0.0,"percent_syste...}
|
||||||
{"time":1646859134,"uid":0,"pid":6,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":6,"percent_usr":0.0,"percent_syste...}
|
||||||
{"time":1646859134,"uid":0,"pid":9,"percent_usr":0.0,"percent_system...}
|
{"time":1646859134,"uid":0,"pid":9,"percent_usr":0.0,"percent_syste...}
|
||||||
...
|
...
|
||||||
|
|
||||||
$ pidstat -hl | jc --pidstat-s -r
|
$ pidstat -hl | jc --pidstat-s -r
|
||||||
|
Reference in New Issue
Block a user