Overview
AProfile represents a loaded profile scoped to a single event type (cpu, wall, alloc, lock). Create profiles with the open() function.
Properties
List of all stacks in the profile. Each stack represents one unique call path.
Total sample count across all stacks.
Recording duration in seconds. Returns
0 for formats without duration metadata (collapsed text, some pprof producers).Start time in seconds from recording start. For root profiles this is
0. For windowed profiles (from open() with start= or from split()), this is the window start offset.End time in seconds from recording start. For root profiles equals
duration. For windowed profiles, this is the window end offset.Selected event type:
"cpu", "wall", "alloc", or "lock".All event types available in the source file. JFR files may contain multiple event types.
Path to the source file.
Methods
hot()
Return top methods by self time or total time.Limit results to top N methods.
0 or omitted returns all methods.Use fully-qualified names (e.g.
java.util.HashMap.resize) instead of short names (HashMap.resize). Changes aggregation granularity.Sort by
"self" (leaf time) or "total" (inclusive time including callees).Method objects with name, fqn, self, self_pct, total, total_pct.
threads()
Return thread sample distribution.Limit to top N threads by sample count.
Thread objects with name, samples, pct.
filter()
Return a new profile containing only stacks matching a predicate.Predicate function. Stacks where
fn(stack) returns True are kept.Profile with filtered stacks. Original profile is unchanged.
group_by()
Partition profile into groups by a key function.Key function. Stacks returning the same key are grouped together.
None excludes the stack.Profile objects.
timeline()
Divide profile into time buckets. JFR only - requires per-sample timestamps.Bucket width. Accepts duration strings (
"1s", "500ms"), or numeric seconds. Numeric values require keyword form: timeline(resolution=30).Target number of buckets. Overrides resolution if specified.
Bucket objects with start, end, samples, label, stacks, profile.
First call to
timeline() triggers a full re-parse of the JFR file with timestamps enabled. This is expensive for large files. Subsequent calls reuse cached data.split()
Split profile at time boundaries. JFR only.Split points in seconds (floats) or duration strings (
"5s", "1m30s"). Must be strictly increasing and within profile duration. Times are relative to the profile’s scope, not recording start.len(times) + 1 profiles representing [0, t1), [t1, t2), …, [tn, end).
tree()
Generate a call tree from a method.Root method name (substring match). Empty string starts from profile root.
Maximum tree depth.
Minimum percentage threshold to include branches.
trace()
Find the hottest path from a method.Starting method name (substring match).
Minimum percentage threshold for path segments.
Use fully-qualified names.
callers()
Show callers of a method as a tree.Target method name (substring match).
Maximum tree depth toward root.
Minimum percentage threshold.
no_idle()
Remove idle leaf frames (same as CLI--no-idle).
summary()
Generate a one-line summary string."event: N samples, Xs, M stacks".