numam-dpdk/usertools
Chengwen Feng 66542840df usertools/telemetry: add JSON pretty print
Currently, the dpdk-telemetry.py show JSON in raw format under
interactive mode, which is not good for human reading.

E.g. The command '/ethdev/xstats,0' will output:
{"/ethdev/xstats": {"rx_good_packets": 0, "tx_good_packets": 0,
"rx_good_bytes": 0, "tx_good_bytes": 0, "rx_missed_errors": 0,
"rx_errors": 0, "tx_errors": 0, "rx_mbuf_allocation_errors": 0,
"rx_q0_packets": 0,...}}

This patch supports JSON pretty print by adding extra indent=2
parameter under interactive mode, so the same command will output:
{
  "/ethdev/xstats": {
    "rx_good_packets": 0,
    "tx_good_packets": 0,
    "rx_good_bytes": 0,
    "tx_good_bytes": 0,
    "rx_missed_errors": 0,
    "rx_errors": 0,
    "rx_mbuf_allocation_errors": 0,
    "rx_q0_packets": 0,
    ...
  }
}

Note: the non-interactive mode is made machine-readable and remains the
original way (it means don't use indent to pretty print).

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
2022-10-31 16:13:55 +01:00
..
cpu_layout.py usertools: fix CPU layout script to be PEP8 compliant 2020-11-13 15:40:21 +01:00
dpdk-devbind.py usertools/devbind: support virtio block device 2022-06-01 11:50:10 +02:00
dpdk-hugepages.py usertools: add options for hugetlbfs mount point owner 2022-06-27 02:24:12 +02:00
dpdk-pmdinfo.py usertools/pmdinfo: rewrite simpler script 2022-10-11 02:11:33 +02:00
dpdk-telemetry-client.py usertools: remove unnecessary parens and else 2020-11-22 22:14:12 +01:00
dpdk-telemetry.py usertools/telemetry: add JSON pretty print 2022-10-31 16:13:55 +01:00
meson.build build: change indentation in infrastructure files 2021-04-21 14:04:09 +02:00