Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[COMMIT seastar master] stall-analyser: use 0 for default value of --minimum

4 views
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
Jul 1, 2024, 6:24:45 AM7/1/24
to seastar-dev@googlegroups.com, Kefu Chai
From: Kefu Chai <kefu...@scylladb.com>
Committer: Avi Kivity <a...@scylladb.com>
Branch: master

stall-analyser: use 0 for default value of --minimum

this change is a cleanup. it:

- use a better name for the `--minimum` option, `args.minimum`
is way too general.
- use the default value of 0 instead of `None`, simpler this way
- just reference `arg.tmin`, simpler this way

Signed-off-by: Kefu Chai <kefu...@scylladb.com>

---
diff --git a/scripts/stall-analyser.py b/scripts/stall-analyser.py
--- a/scripts/stall-analyser.py
+++ b/scripts/stall-analyser.py
@@ -42,7 +42,7 @@ def get_command_line_parser():
help='Smart trim of long lines to width characters (0=disabled)')
parser.add_argument('-d', '--direction', choices=['bottom-up', 'top-down'], default='bottom-up',
help='Print graph bottom-up (default, callees first) or top-down (callers first)')
- parser.add_argument('-m', '--minimum', type=int, default=None,
+ parser.add_argument('-m', '--minimum', type=int, dest='tmin', default=0,
help='Process only stalls lasting the given time, in milliseconds, or longer')
parser.add_argument('-b', '--branch-threshold', type=float, default=0.03,
help='Drop branches responsible for less than this threshold relative to the previous level, not global. (default 3%%)')
@@ -347,7 +347,6 @@ def main():
resolver = addr2line.BacktraceResolver(executable=args.executable,
concise=not args.full_function_names)
graph = Graph(resolver)
- tmin = args.minimum or 0
for s in args.file:
if comment.search(s):
continue
@@ -375,15 +374,15 @@ def main():
# ?? ??:0
if address_threshold:
trace = list(dropwhile(lambda addr: int(addr, 0) >= address_threshold, trace))
- if t >= tmin:
+ if t >= args.tmin:
graph.process_trace(trace, t)

try:
if not graph:
print("No input data found. Please run `stall-analyser.py --help` for usage instruction")
sys.exit()
print_command_line_options(args)
- print_stats(tally, tmin)
+ print_stats(tally, args.tmin)
graph.print_graph(args.direction, args.width, args.branch_threshold)
except BrokenPipeError:
pass
Reply all
Reply to author
Forward
0 new messages