option for logscale on histogram y axis

This commit is contained in:
2026-07-09 08:38:51 +02:00
parent 14e3f6427b
commit 94ef6c7350
+9 -2
View File
@@ -1479,7 +1479,8 @@ def histogram_table(
return edges, counts
def histo_graphs(out_rows: list[OutputRow], colnames: list[str]):
def histo_graphs(out_rows: list[OutputRow], args: argparse.Namespace):
colnames = args.histo.lower().split(',')
for metric in colnames:
tmpfile = tempfile.NamedTemporaryFile(mode='w+t', delete=False,
dir='.',prefix=f"tmp-seff-{metric}",
@@ -1503,6 +1504,9 @@ def histo_graphs(out_rows: list[OutputRow], colnames: list[str]):
tmpfile.write("\n")
tmpfile.close()
logy = ""
if args.hlogy:
logy = "set logscale y\n"
gnuplot_cmd = f"""set title "{metric} distribution" noenhanced
set xlabel "{metric}" noenhanced
set ylabel "Jobs"
@@ -1513,6 +1517,7 @@ set terminal dumb enhanced size 120, 30
set colorsequence classic
set terminal dumb ansi size 120, 30
{logy}
plot_cmd = 'plot "{tmpfile.name}" \\
"""
# gnuplot_cmd += f' using 1:2 with boxes title "{names[0]}" \\\n'
@@ -1621,6 +1626,8 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
p.add_argument("--expr", help="filter using an arithmetic expression using column names as variables (case insensitive). Don't use for state (use --state flag instead).",
default=None)
p.add_argument("-H", "--histo", help=f"print histogram of the given metric (Supported columns: {', '.join(HISTO_COLUMNS)}).", default=None)
p.add_argument("--hlogy", action="store_true", help="use logscale for histogram y axis")
# Options for writing/reading cache files
p.add_argument("-B", "--write-binary-cache", help="write a binary cache file in gzipped msgpack format")
p.add_argument("-L", "--load-binary-cache", help="load a binary cache file in gzipped msgpack format")
@@ -1711,7 +1718,7 @@ def main(argv: list[str] | None = None) -> int:
# Histogramming
if args.histo:
histo_graphs(out_rows, args.histo.lower().split(','))
histo_graphs(out_rows, args)
return 0