From 94ef6c73503ee6aff65ad71b5bdb5d09a62036ff Mon Sep 17 00:00:00 2001 From: Derek Feichtinger Date: Thu, 9 Jul 2026 08:13:50 +0200 Subject: [PATCH] option for logscale on histogram y axis --- slurm-eff-tool.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/slurm-eff-tool.py b/slurm-eff-tool.py index 02fe580..bdcfa64 100755 --- a/slurm-eff-tool.py +++ b/slurm-eff-tool.py @@ -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