Skip to content

Commit

Permalink
tools/threadsnoop: Add -h option
Browse files Browse the repository at this point in the history
Import argparser and add basic implementation for this. Now user can
use -h option for threadsnoop tool.
  • Loading branch information
Bojun-Seo authored and yonghong-song committed Nov 9, 2024
1 parent 791b96e commit 2b82d76
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/threadsnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@

from __future__ import print_function
from bcc import BPF
import argparse

examples = """examples:
./threadsnoop # list new thread creation
"""

description = """
List new thread creation.
"""

parser = argparse.ArgumentParser(description=description,
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=examples)
args = parser.parse_args()

# load BPF program
b = BPF(text="""
Expand Down
13 changes: 13 additions & 0 deletions tools/threadsnoop_example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ The output shows a dockerd process creating several threads with the start
routine threadentry(), and docker-containe (truncated) and systemd-journal
also starting threads: in their cases, the function had no symbol information
available, so their addresses are printed in hex.

USAGE message:

# ./threadsnoop.py -h
usage: threadsnoop.py [-h]

List new thread creation.

options:
-h, --help show this help message and exit

examples:
./threadsnoop # list new thread creation

0 comments on commit 2b82d76

Please sign in to comment.