blob: 988092691227e1f9ad2a1177909257e1a35a93e2 [file] [log] [blame]
Sasha Goldshteinc0a63522016-10-29 13:44:55 -07001Demonstrations of uthreads.
2
3
Marko Myllynen9f3662e2018-10-10 21:48:53 +03004uthreads traces thread creation events in Java or raw (C) pthreads, and prints
Sasha Goldshteinc0a63522016-10-29 13:44:55 -07005details about the newly created thread. For Java threads, the thread name is
6printed; for pthreads, the thread's start function is printed, if there is
7symbol information to resolve it.
8
9For example, trace all Java thread creation events:
10
11# ./uthreads -l java 27420
12Tracing thread events in process 27420 (language: java)... Ctrl-C to quit.
13TIME ID TYPE DESCRIPTION
1418.596 R=9/N=0 start SIGINT handler
1518.596 R=4/N=0 stop Signal Dispatcher
16^C
17
18The ID column in the preceding output shows the thread's runtime ID and native
19ID, when available. The accuracy of this information depends on the Java
20runtime.
21
22
23Next, trace only pthread creation events in some native application:
24
25# ./uthreads 27450
Marko Myllynen9f3662e2018-10-10 21:48:53 +030026Tracing thread events in process 27450 (language: c)... Ctrl-C to quit.
Sasha Goldshteinc0a63522016-10-29 13:44:55 -070027TIME ID TYPE DESCRIPTION
Sasha Goldshteinb1bff012017-02-08 23:25:28 -0500280.924 27462 pthread primes_thread [primes]
290.927 27463 pthread primes_thread [primes]
300.928 27464 pthread primes_thread [primes]
310.928 27465 pthread primes_thread [primes]
Sasha Goldshteinc0a63522016-10-29 13:44:55 -070032^C
33
34The thread name ("primes_thread" in this example) is resolved from debuginfo.
35If symbol information is not present, the thread's start address is printed
36instead.
37
38
39USAGE message:
40
41# ./uthreads -h
Marko Myllynen9f3662e2018-10-10 21:48:53 +030042usage: uthreads.py [-h] [-l {c,java,none}] [-v] pid
Sasha Goldshteinc0a63522016-10-29 13:44:55 -070043
44Trace thread creation/destruction events in high-level languages.
45
46positional arguments:
47 pid process id to attach to
48
49optional arguments:
50 -h, --help show this help message and exit
Marko Myllynen9f3662e2018-10-10 21:48:53 +030051 -l {c,java,none}, --language {c,java,none}
Sasha Goldshteinc0a63522016-10-29 13:44:55 -070052 language to trace (none for pthreads only)
53 -v, --verbose verbose mode: print the BPF program (for debugging
54 purposes)
55
56examples:
Marko Myllynen9f3662e2018-10-10 21:48:53 +030057 ./uthreads -l java 185 # trace Java threads in process 185
58 ./uthreads -l none 12245 # trace only pthreads in process 12245