Lines Matching +full:profile +full:- +full:traces
2 # @lint-avoid-python-3-compatibility-imports
4 # profile Profile CPU usage by sampling stack traces at a timed interval.
7 # This is an efficient profiler, as stack traces are frequency counted in
10 # at the end of the profile, greatly reducing the kernel<->user transfer.
16 # Kernel stacks are post-process in user-land to skip the interrupt framework
18 # of frames to skip with -s, provided you know what that is. If you get -s
21 # Note: if another perf-based sampling session is active, the output may become
37 # 15-Jul-2016 Brendan Gregg Created this.
73 ./profile # profile stack traces at 49 Hertz until Ctrl-C
74 ./profile -F 99 # profile stack traces at 99 Hertz
75 ./profile 5 # profile at 49 Hertz for 5 seconds only
76 ./profile -f 5 # output in folded format for flame graphs
77 ./profile -p 185 # only profile threads for PID 185
78 ./profile -U # only show user space stacks (no kernel)
79 ./profile -K # only show kernel space stacks (no user)
80 ./profile -S 11 # always skip 11 frames of kernel stack
83 description="Profile CPU stack traces at a timed interval",
87 thread_group.add_argument("-p", "--pid", type=positive_int,
88 help="profile this PID only")
91 stack_group.add_argument("-U", "--user-stacks-only", action="store_true",
93 stack_group.add_argument("-K", "--kernel-stacks-only", action="store_true",
95 parser.add_argument("-F", "--frequency", type=positive_int, default=49,
97 parser.add_argument("-d", "--delimited", action="store_true",
99 parser.add_argument("-a", "--annotations", action="store_true",
101 parser.add_argument("-f", "--folded", action="store_true",
103 parser.add_argument("--stack-storage-size", default=2048,
105 help="the number of unique stack traces that can be stored and "
107 parser.add_argument("-S", "--kernel-skip", type=positive_int, default=0,
116 pid = int(args.pid) if args.pid is not None else -1
175 * User didn't specify a skip value (-s), so we will figure
178 * This is likely x86_64 specific; can use -s as a workaround
197 perf_filter = "-a"
201 perf_filter = '-p %s' % args.pid
218 kernel_stack_get = "-1"
221 user_stack_get = "-1"
240 print("... Hit Ctrl-C to end.")
268 Perf.perf_event_open(0, pid=-1, ptype=Perf.PERF_TYPE_SOFTWARE,
273 " perf record -F 49 -e cpu-clock %s -- sleep 1\n"
285 # as cleanup can take some time, trap Ctrl-C:
305 k.kernel_stack_id != -errno.EFAULT) or \
307 k.user_stack_id != -errno.EFAULT):
310 if k.kernel_stack_id == -errno.ENOMEM or \
311 k.user_stack_id == -errno.ENOMEM:
344 line = [k.name.decode('utf-8', 'replace')] + \
346 (do_delimiter and ["-"] or []) + \
350 # print default multi-line stack output.
354 print(" --")
357 print(" %-16s %s (%d)" % ("-", k.name, k.pid))
363 " Consider increasing --stack-storage-size."
364 print("WARNING: %d stack traces could not be displayed.%s" %