name histogram output files and option to keep files
This commit is contained in:
+14
-2
@@ -1490,7 +1490,7 @@ def histo_graphs(out_rows: list[OutputRow], args: argparse.Namespace):
|
||||
|
||||
if term in ("svg", "png"):
|
||||
width, height = 900, 600
|
||||
outfileroot="./histo-out"
|
||||
outfileroot = args.hprefix
|
||||
plotstyle = ('set style fill transparent solid 0.35 noborder\n'
|
||||
'set grid')
|
||||
linestyle = "with boxes"
|
||||
@@ -1572,7 +1572,13 @@ def histo_graphs(out_rows: list[OutputRow], args: argparse.Namespace):
|
||||
except FileNotFoundError:
|
||||
sys.stderr.write("ERROR: Cannot execute gnuplot for histogram creation. Is it installed?\n")
|
||||
sys.exit(1)
|
||||
os.remove(tmpfile.name)
|
||||
|
||||
if not args.hkeepfiles:
|
||||
os.remove(tmpfile.name)
|
||||
else:
|
||||
gpltfname = os.path.splitext(tmpfile.name)[0] + ".gplot"
|
||||
with open(gpltfname, "w", newline="", encoding="utf-8") as f:
|
||||
f.write(gnuplot_cmd)
|
||||
|
||||
# HISTOGRAMMING CODE END
|
||||
|
||||
@@ -1657,10 +1663,16 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
|
||||
p.add_argument("-s", "--sort", help="comma-separated numeric sort columns or short aliases; prefix with - for descending.")
|
||||
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)
|
||||
|
||||
# Histogramming
|
||||
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")
|
||||
p.add_argument("--hterm", help=f"terminal type to plot histogram to.",
|
||||
default="dumb", choices=("dumb", "png", "svg"))
|
||||
p.add_argument("--hprefix", help="prefix for output histogram files",
|
||||
default="histo-slurm-eff-tool-histo-")
|
||||
p.add_argument("--hkeepfiles",help="keep gnuplot command and data files",
|
||||
action="store_true", default=False)
|
||||
|
||||
# Options for writing/reading cache files
|
||||
p.add_argument("-B", "--write-binary-cache", help="write a binary cache file in gzipped msgpack format")
|
||||
|
||||
Reference in New Issue
Block a user