TABLE dateformat(file.ctime,"yyyy-MM-dd HH:mm:ss") as "created" WHERE this.file.name = dateformat(file.ctime,"yyyy-MM-dd")
SORT file.ctime ASCasync-profiler
- GitHub - async-profiler/async-profiler: Sampling CPU and HEAP profiler for Java featuring AsyncGetCallTrace + perf_events
- profiler | arthas
The following is a complete list of the command-line options accepted by profiler.sh script.
以下是 profiler.sh 脚本接受的命令行选项的完整列表。
-
start- starts profiling in semi-automatic mode, i.e. profiler will run untilstopcommand is explicitly called.
start- 以半自动模式开始分析,即探查器将运行,直到显式调用stop命令。 -
resume- starts or resumes earlier profiling session that has been stopped. All the collected data remains valid. The profiling options are not preserved between sessions, and should be specified again.
resume- 启动或恢复已停止的早期分析会话。所有收集的数据仍然有效。分析选项不会在会话之间保留,应再次指定。 -
stop- stops profiling and prints the report.
stop- 停止分析并打印报告。 -
dump- dump collected data without stopping profiling session.
dump- 在不停止分析会话的情况下转储收集的数据。 -
check- check if the specified profiling event is available.
check- 检查指定的分析事件是否可用。 -
status- prints profiling status: whether profiler is active and for how long.
status- 打印分析状态:探查器是否处于活动状态以及活动时长。 -
meminfo- prints used memory statistics.
meminfo- 打印已用内存统计信息。 -
list- show the list of profiling events available for the target process (if PID is specified) or for the default JVM.
list- 显示可用于目标进程(如果指定了 PID)或缺省 JVM 的性能分析事件列表。 -
-d N- the profiling duration, in seconds. If nostart,resume,stoporstatusoption is given, the profiler will run for the specified period of time and then automatically stop.
-d N- 分析持续时间,以秒为单位。如果未给出start、resume、stop或status选项,探查器将在指定的时间段内运行,然后自动停止。
Example:./profiler.sh -d 30 8983示例:./profiler.sh -d 30 8983 -
-e event- the profiling event:cpu,alloc,lock,cache-missesetc. Uselistto see the complete list of available events.
-e event- 性能分析事件:cpu、alloc、lock、cache-misses等。使用list查看可用事件的完整列表。In allocation profiling mode the top frame of every call trace is the class of the allocated object, and the counter is the heap pressure (the total size of allocated TLABs or objects outside TLAB).
在分配分析模式下,每个调用跟踪的顶部帧是已分配对象的类,计数器是堆压力(分配的 TLAB 或 TLAB 外部对象的总大小)。In lock profiling mode the top frame is the class of lock/monitor, and the counter is number of nanoseconds it took to enter this lock/monitor.
在锁定分析模式下,顶部帧是锁定/监视器的类,计数器是进入此锁定/监视器所花费的纳秒数。Two special event types are supported on Linux: hardware breakpoints and kernel tracepoints:
Linux 支持两种特殊事件类型:硬件断点和内核跟踪点:-e mem:<func>[:rwx]sets read/write/exec breakpoint at function<func>. The format ofmemevent is the same as inperf-record. Execution breakpoints can be also specified by the function name, e.g.-e mallocwill trace all calls of nativemallocfunction.
-e mem:<func>[:rwx]在函数<func>上设置读/写/执行断点。mem事件的格式与perf-record中的格式相同。执行断点也可以由函数名称指定,例如-e malloc将跟踪本机malloc函数的所有调用。-e trace:<id>sets a kernel tracepoint. It is possible to specify tracepoint symbolic name, e.g.-e syscalls:sys_enter_openwill trace allopensyscalls.
-e trace:<id>设置内核跟踪点。可以指定跟踪点符号名称,例如-e syscalls:sys_enter_open将跟踪所有open系统调用。
-
-i N- sets the profiling interval in nanoseconds or in other units, if N is followed byms(for milliseconds),us(for microseconds), ors(for seconds). Only CPU active time is counted. No samples are collected while CPU is idle. The default is 10000000 (10ms).
-i N- 如果 N 后跟ms(表示毫秒)、us(表示微秒)或s(表示秒),则以纳秒或其他单位设置分析间隔。仅计算 CPU 活动时间。CPU 空闲时不收集任何样本。默认值为 10000000(10ms)。
Example:./profiler.sh -i 500us 8983示例:./profiler.sh -i 500us 8983 -
--alloc N- allocation profiling interval in bytes or in other units, if N is followed byk(kilobytes),m(megabytes), org(gigabytes).
--alloc N- 分配分析间隔(以字节或其他单位为单位),如果 N 后跟k(千字节)、m(兆字节)或g(千兆字节)。 -
--live- retain allocation samples with live objects only (object that have not been collected by the end of profiling session). Useful for finding Java heap memory leaks.
--live- 仅保留包含活动对象的分配样本(在分析会话结束时尚未收集的对象)。对于查找 Java 堆内存泄漏很有用。 -
--lock N- lock profiling threshold in nanoseconds (or other units). In lock profiling mode, record contended locks that the JVM has waited for longer than the specified duration.
--lock N- 以纳秒(或其他单位)为单位的锁定分析阈值。在锁分析方式下,记录 JVM 等待的时间超过指定持续时间的争用锁。 -
-j N- sets the Java stack profiling depth. This option will be ignored if N is greater than default 2048.
-j N- 设置 Java 堆栈分析深度。如果 N 大于默认值 2048,则此选项将被忽略。
Example:./profiler.sh -j 30 8983示例:./profiler.sh -j 30 8983 -
-t- profile threads separately. Each stack trace will end with a frame that denotes a single thread.
-t- 单独配置文件线程。每个堆栈跟踪都将以一个表示单个线程的帧结尾。
Example:./profiler.sh -t 8983示例:./profiler.sh -t 8983 -
-s- print simple class names instead of FQN.
-s- 打印简单的类名而不是 FQN。 -
-g- print method signatures.
-g- 打印方法签名。 -
-a- annotate JIT compiled methods with_[j], inlined methods with_[i], interpreted methods with_[0]and C1 compiled methods with_[1].
-a- 使用_[j]注释 JIT 编译方法、使用_[i]注释内联方法、使用_[0]注释解释方法和使用_[1]注释 C1 编译方法。 -
-l- prepend library names to symbols, e.g.libjvm.so`JVM_DefineClassWithSource.
-l- 在符号前面附加库名称,例如libjvm.so`JVM_DefineClassWithSource. -
-o fmt- specifies what information to dump when profiling ends.fmtcan be one of the following options:
-o fmt- 指定分析结束时要转储的信息。fmt可以是以下选项之一:traces[=N]- dump call traces (at most N samples);
traces[=N]- 转储调用跟踪(最多 N 个样本);flat[=N]- dump flat profile (top N hot methods);
flat[=N]- 转储平面配置文件(前 N 种热方法);
can be combined withtraces, e.g.traces=200,flat=200
可以与traces结合使用,例如traces=200,flat=200jfr- dump events in Java Flight Recorder format readable by Java Mission Control. This does not require JDK commercial features to be enabled.
jfr- Java 任务控制可读的 Java 飞行记录器格式的转储事件。这不需要启用 JDK 商业功能。collapsed- dump collapsed call traces in the format used by FlameGraph script. This is a collection of call stacks, where each line is a semicolon separated list of frames followed by a counter.
collapsed- 以 FlameGraph 脚本使用的格式转储折叠的调用跟踪。这是调用堆栈的集合,其中每行都是一个以分号分隔的帧列表,后跟一个计数器。flamegraph- produce Flame Graph in HTML format.
flamegraph- 生成 HTML 格式的火焰图。tree- produce Call Tree in HTML format.
tree- 生成 HTML 格式的调用树。
--reverseoption will generate backtrace view.
--reverse选项将生成回溯视图。
-
--total- count the total value of the collected metric instead of the number of samples, e.g. total allocation size.
--total- 计算收集的指标的总值,而不是样本数,例如总分配大小。 -
--chunksize N,--chunktime N- approximate size and time limits for a single JFR chunk. A new chunk will be started whenever either limit is reached. The defaultchunksizeis 100MB, and the defaultchunktimeis 1 hour.
--chunksize N,--chunktime N- 单个 JFR 块的大致大小和时间限制。每当达到任一限制时,都会启动一个新块。默认chunksize为 100MB,默认chunktime为 1 小时。
Example:./profiler.sh -f profile.jfr --chunksize 100m --chunktime 1h 8983示例:./profiler.sh -f profile.jfr --chunksize 100m --chunktime 1h 8983 -
-I include,-X exclude- filter stack traces by the given pattern(s).-Idefines the name pattern that must be present in the stack traces, while-Xis the pattern that must not occur in any of stack traces in the output.-Iand-Xoptions can be specified multiple times. A pattern may begin or end with a star*that denotes any (possibly empty) sequence of characters.
-I include,-X exclude- 按给定模式过滤堆栈跟踪。-I定义堆栈跟踪中必须存在的名称模式,而-X是输出中任何堆栈跟踪中不得出现的模式。 可以多次指定-I和-X选项。模式可以以星号*开头或结尾,表示任何(可能是空的)字符序列。
Example:./profiler.sh -I 'Primes.*' -I 'java/*' -X '*Unsafe.park*' 8983示例:./profiler.sh -I 'Primes.*' -I 'java/*' -X '*Unsafe.park*' 8983 -
--title TITLE,--minwidth PERCENT,--reverse- FlameGraph parameters.
--title TITLE,--minwidth PERCENT,--reverse- 火焰图参数。
Example:./profiler.sh -f profile.html --title "Sample CPU profile" --minwidth 0.5 8983示例:./profiler.sh -f profile.html --title "Sample CPU profile" --minwidth 0.5 8983 -
-f FILENAME- the file name to dump the profile information to.
-f FILENAME- 要将配置文件信息转储到的文件名。
%pin the file name is expanded to the PID of the target JVM;
文件名中的%p扩展为目标 JVM 的 PID;
%t- to the timestamp;
%t- 到时间戳;
%n{MAX}- to the sequence number;
%n{MAX}- 到序列号;
%{ENV}- to the value of the given environment variable.
%{ENV}- 给定环境变量的值。
Example:./profiler.sh -o collapsed -f /tmp/traces-%t.txt 8983示例:./profiler.sh -o collapsed -f /tmp/traces-%t.txt 8983 -
--loop TIME- run profiler in a loop (continuous profiling). The argument is either a clock time (hh:mm:ss) or a loop duration inseconds,minutes,hours, ordays. Make sure the filename includes a timestamp pattern, or the output will be overwritten on each iteration.
--loop TIME- 循环运行探查器(连续分析)。参数是时钟时间 (hh:mm:ss) 或seconds、minutes、hours 或days 中的循环持续时间。确保文件名包含时间戳模式,否则每次迭代时都会覆盖输出。
Example:./profiler.sh --loop 1h -f /var/log/profile-%t.jfr 8983示例:./profiler.sh --loop 1h -f /var/log/profile-%t.jfr 8983 -
--all-user- include only user-mode events. This option is helpful when kernel profiling is restricted byperf_event_paranoidsettings.
--all-user- 仅包含用户模式事件。当内核分析受perf_event_paranoid设置限制时,此选项非常有用。 -
--sched- group threads by Linux-specific scheduling policy: BATCH/IDLE/OTHER.
--sched- 按特定于 Linux 的调度策略对线程进行分组:批处理/空闲/其他。 -
--cstack MODE- how to walk native frames (C stack). Possible modes arefp(Frame Pointer),dwarf(DWARF unwind info),lbr(Last Branch Record, available on Haswell since Linux 4.1), andno(do not collect C stack).
--cstack MODE- 如何遍历本机帧(C 堆栈)。可能的模式是fp(帧指针),dwarf(DWARF 展开信息),lbr(最后分支记录,从 Linux 4.1 开始在 Haswell 上可用)和no(不收集 C 堆栈)。By default, C stack is shown in cpu, itimer, wall-clock and perf-events profiles. Java-level events like
allocandlockcollect only Java stack.
默认情况下,C 堆栈显示在 CPU、itimer、挂钟和性能事件配置文件中。像alloc和lock这样的 Java 级事件只收集 Java 堆栈。 -
--clock SOURCE- clock source for JFR timestamps:tsc(default) ormonotonic(equivalent forCLOCK_MONOTONIC).
--clock SOURCE- JFR 时间戳的时钟源:tsc(默认)或monotonic(相当于CLOCK_MONOTONIC)。 -
--begin function,--end function- automatically start/stop profiling when the specified native function is executed.
--begin function,--end function- 执行指定的本机函数时自动启动/停止分析。 -
--ttsp- time-to-safepoint profiling. An alias for
--ttsp- 安全点分析时间。的别名
--begin SafepointSynchronize::begin --end RuntimeService::record_safepoint_synchronized
It is not a separate event type, but rather a constraint. Whatever event type you choose (e.g.cpuorwall), the profiler will work as usual, except that only events between the safepoint request and the start of the VM operation will be recorded.
它不是一个单独的事件类型,而是一个约束。无论您选择哪种事件类型(例如cpu或wall),探查器将照常工作,但仅记录 safepoint 请求与 VM 操作启动之间的事件。 -
--jfrsync CONFIG- start Java Flight Recording with the given configuration synchronously with the profiler. The output .jfr file will include all regular JFR events, except that execution samples will be obtained from async-profiler. This option implies-o jfr.
--jfrsync CONFIG- 使用分析器同步启动具有给定配置的 Java 飞行记录。输出 .jfr 文件将包含所有常规 JFR 事件,但执行样本将从异步分析器获取。此选项意味着-o jfr。CONFIGis a predefined JFR profile or a JFR configuration file (.jfc).
CONFIG是预定义的 JFR 配置文件或 JFR 配置文件 (.jfc)。
Example:
./profiler.sh -e cpu --jfrsync profile -f combined.jfr 8983示例:./profiler.sh -e cpu --jfrsync profile -f combined.jfr 8983 -
--fdtransfer- runs “fdtransfer” alongside, which is a small program providing an interface for the profiler to accessperf_event_openeven while this syscall is unavailable for the profiled process (due to low privileges). See Profiling Java in a container.
--fdtransfer- 同时运行“fdtransfer”,这是一个小程序,为探查器提供了一个访问perf_event_open的接口,即使此系统调用对所分析的进程不可用(由于权限低)。请参 阅在容器中分析 Java 。 -
-v,--version- prints the version of profiler library. If PID is specified, gets the version of the library loaded into the given process.
-v,--version- 打印探查器库的版本。如果指定了 PID,则获取加载到给定进程中的库版本。