Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/profile: fix kernel delimiter when folding #2758

Merged
merged 2 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
retain delimiter with folding enabled
  • Loading branch information
graphaelli committed Feb 19, 2020
commit 9707ffe057306aedee0822989885a160c4bb4219
5 changes: 2 additions & 3 deletions tools/offwaketime.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ def stack_id_err(stack_id):
args = parser.parse_args()
folded = args.folded
duration = int(args.duration)
need_delimiter = args.delimited and not any([args.folded,
args.kernel_stacks_only,
args.user_stacks_only])

# signal handler
def signal_ignore(signal, frame):
Expand Down Expand Up @@ -295,6 +292,8 @@ def signal_ignore(signal, frame):
has_enomem = False
counts = b.get_table("counts")
stack_traces = b.get_table("stack_traces")
need_delimiter = args.delimited and not (args.kernel_stacks_only or
args.user_stacks_only)
for k, v in sorted(counts.items(), key=lambda counts: counts[1].value):
# handle get_stackid errors
if not args.user_stacks_only:
Expand Down
7 changes: 3 additions & 4 deletions tools/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ def stack_id_err(stack_id):
pid = int(args.pid) if args.pid is not None else -1
duration = int(args.duration)
debug = 0
need_delimiter = args.delimited and not any([args.folded,
args.kernel_stacks_only,
args.user_stacks_only])
need_delimiter = args.delimited and not (args.kernel_stacks_only or
args.user_stacks_only)
# TODO: add stack depth, and interval

#
Expand Down Expand Up @@ -333,7 +332,7 @@ def aksym(addr):
else:
line.extend([b.sym(addr, k.pid) for addr in reversed(user_stack)])
if not args.user_stacks_only:
line.extend(b["-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
line.extend([b"-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
if stack_id_err(k.kernel_stack_id):
line.append(b"[Missed Kernel Stack]")
else:
Expand Down