- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class ProfileServlet
extends javax.servlet.http.HttpServlet
Servlet that runs async-profiler as web-endpoint.
Following options from async-profiler can be specified as query paramater.
// -e event profiling event: cpu|alloc|lock|cache-misses etc.
// -d duration run profiling for duration seconds (integer)
// -i interval sampling interval in nanoseconds (long)
// -j jstackdepth maximum Java stack depth (integer)
// -b bufsize frame buffer size (long)
// -t profile different threads separately
// -s simple class names instead of FQN
// -o fmt[,fmt...] output format: summary|traces|flat|collapsed|svg|tree|jfr
// --width px SVG width pixels (integer)
// --height px SVG frame height pixels (integer)
// --minwidth px skip frames smaller than px (double)
// --reverse generate stack-reversed FlameGraph / Call tree
Example:
- To collect 30 second CPU profile of current process (returns FlameGraph svg)
curl "http://localhost:10002/prof"
- To collect 1 minute CPU profile of current process and output in tree format (html)
curl "http://localhost:10002/prof?output=tree&duration=60"
- To collect 30 second heap allocation profile of current process (returns FlameGraph svg)
curl "http://localhost:10002/prof?event=alloc"
- To collect lock contention profile of current process (returns FlameGraph svg)
curl "http://localhost:10002/prof?event=lock"
Following event types are supported (default is 'cpu') (NOTE: not all OS'es support all events)
// Perf events:
// cpu
// page-faults
// context-switches
// cycles
// instructions
// cache-references
// cache-misses
// branches
// branch-misses
// bus-cycles
// L1-dcache-load-misses
// LLC-load-misses
// dTLB-load-misses
// mem:breakpoint
// trace:tracepoint
// Java events:
// alloc
// lock
- See Also:
- Serialized Form