mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpumf: Adapt to new JSON Lines text format
util_fmt now provides support for JSON Lines text format. Adapt certain checks in the code and document the newly supported format in the man pages for lshwc and lspai accordingly. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -700,7 +700,7 @@ static int do_it(char *s)
|
||||
|
||||
if (output_format == FMT_CSV)
|
||||
flags |= FMT_NOMETA;
|
||||
if (output_format == FMT_JSON || output_format == FMT_JSONSEQ)
|
||||
if (util_fmt_is_json(output_format))
|
||||
flags |= FMT_HANDLEINT;
|
||||
if (quote_all)
|
||||
flags |= FMT_QUOTEALL;
|
||||
@@ -708,7 +708,7 @@ static int do_it(char *s)
|
||||
mk_labels();
|
||||
util_fmt_init(stdout, output_format, flags, 1);
|
||||
util_fmt_obj_start(FMT_DEFAULT, "lshwc");
|
||||
if (output_format == FMT_JSON || output_format == FMT_JSONSEQ) {
|
||||
if (util_fmt_is_json(output_format)) {
|
||||
util_fmt_obj_start(FMT_ROW, "cpumcf info");
|
||||
util_fmt_pair(FMT_PERSIST, "counter first", "%d", cfvn);
|
||||
util_fmt_pair(FMT_PERSIST, "counter second", "%d", csvn);
|
||||
|
||||
@@ -138,7 +138,7 @@ Apply quoting to every output element, regardless of content or format.
|
||||
.TP
|
||||
.BR \-f ", " \-\-format \fI\ FORMAT\fP
|
||||
Retrieve output in one of the following formats:
|
||||
JSON, CSV, JSON-SEQ or PAIRS.
|
||||
JSON, CSV, JSON-SEQ, JSONL or PAIRS.
|
||||
If no format is specified, the output defaults to CSV.
|
||||
.
|
||||
.SS JSON Output Structure
|
||||
|
||||
@@ -136,7 +136,7 @@ Default sort order is PAI counter name.
|
||||
.TP
|
||||
.BI \-\-format "\ FORMAT"
|
||||
Retrieve output in one of the following formats:
|
||||
JSON, csv, json-seq or pairs.
|
||||
JSON, csv, json-seq, jsonl or pairs.
|
||||
If no format is specified,
|
||||
the output defaults to a human-readable format.
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user