mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-10-26 22:21:58 +03:00
Add --log-count option to plot_histogram.py
This commit is contained in:
parent
7684efdd2d
commit
77e7b6cd65
@ -17,15 +17,18 @@ parser.add_argument("--bins", help="Number of bins (default: auto)")
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)"
|
"--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument("-o", "--output", help="Save image to the given filename.")
|
||||||
"-o", "--output", help="Save image to the given filename."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--t-min", metavar="T", help="Minimum time to be displayed (seconds)"
|
"--t-min", metavar="T", help="Minimum time to be displayed (seconds)"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--t-max", metavar="T", help="Maximum time to be displayed (seconds)"
|
"--t-max", metavar="T", help="Maximum time to be displayed (seconds)"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--log-count",
|
||||||
|
help="Use a logarithmic y-axis for the event count",
|
||||||
|
action="store_true",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -45,7 +48,11 @@ bins = int(args.bins) if args.bins else "auto"
|
|||||||
histtype = args.type if args.type else "bar"
|
histtype = args.type if args.type else "bar"
|
||||||
|
|
||||||
plt.hist(
|
plt.hist(
|
||||||
all_times, label=labels, bins=bins, histtype=histtype, range=(t_min, t_max),
|
all_times,
|
||||||
|
label=labels,
|
||||||
|
bins=bins,
|
||||||
|
histtype=histtype,
|
||||||
|
range=(t_min, t_max),
|
||||||
)
|
)
|
||||||
plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})
|
plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})
|
||||||
|
|
||||||
@ -53,6 +60,11 @@ plt.xlabel("Time [s]")
|
|||||||
if args.title:
|
if args.title:
|
||||||
plt.title(args.title)
|
plt.title(args.title)
|
||||||
|
|
||||||
|
if args.log_count:
|
||||||
|
plt.yscale("log")
|
||||||
|
else:
|
||||||
|
plt.ylim(0, None)
|
||||||
|
|
||||||
if args.output:
|
if args.output:
|
||||||
plt.savefig(args.output)
|
plt.savefig(args.output)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user