benchtests: Enable scripts/plot_strings.py to read stdin
authorNaohiro Tamura <naohirot@fujitsu.com>
Mon, 13 Sep 2021 03:34:21 +0000 (09:04 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Mon, 13 Sep 2021 03:34:21 +0000 (09:04 +0530)
commit3886eaff9d5a807732284a562f2d051e5d54fefa
tree4a2521d4de1b0bad05eaf72d9318da91a6ef861c
parentabd383584b16dd0fb1bbf40e4ece65ebe7b839ec
benchtests: Enable scripts/plot_strings.py to read stdin

This patch enables scripts/plot_strings.py to read a benchmark result
file from stdin.
To keep backward compatibility, that is to keep accepting multiple of
benchmark result files in argument, blank argument doesn't mean stdin,
but '-' does.
Therefore nargs parameter of ArgumentParser.add_argument() method is
not changed to '?', but keep '+'.

ex:
  $ jq '.' bench-memset.out | plot_strings.py -
  $ jq '.' bench-memset.out | plot_strings.py - bench-memset-large.out
  $ plot_strings.py bench-memset.out bench-memset-large.out

error ex:
  $ jq '.' bench-memset.out | plot_strings.py

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
benchtests/scripts/plot_strings.py