Skip to content

feat: GC-aware allocation profiling via JFR (#118)#123

Closed
rlaope wants to merge 1 commit intomasterfrom
feat/gc-profiling
Closed

feat: GC-aware allocation profiling via JFR (#118)#123
rlaope wants to merge 1 commit intomasterfrom
feat/gc-profiling

Conversation

@rlaope
Copy link
Copy Markdown
Owner

@rlaope rlaope commented Apr 12, 2026

Summary

  • New argus gcprofile <pid> command that identifies which code paths allocate the most objects
  • Uses JFR ObjectAllocationInNewTLAB events to rank allocation sites by bytes
  • Answers: "Which code is causing GC pressure?"

Usage

argus gcprofile 12345                 # 30s default profiling
argus gcprofile 12345 --duration=60   # 60s profiling
argus gcprofile 12345 --top=20        # show top 20 sites

Changes

  • GcProfileCommand โ€” triggers JFR recording, waits, dumps, analyzes
  • AllocationProfiler โ€” parses JFR files, aggregates by stack trace top frame
  • AllocationProfilerTest โ€” unit tests for aggregation and ranking
  • i18n entries (en/ko/ja)

Output Example

โ•ญโ”€ GC Allocation Profile โ”€โ”€ pid:12345 โ”€โ”€ 30s โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                               โ”‚
โ”‚  Total Allocated: 4.2 GB in 30s (140 MB/s)                   โ”‚
โ”‚                                                               โ”‚
โ”‚  #  Rate       Total    Stack                                 โ”‚
โ”‚  1  890 MB/s   2.4 GB   com.app.OrderProcessor.process:142   โ”‚
โ”‚  2  340 MB/s   920 MB   com.app.cache.LRUCache.put:78        โ”‚
โ”‚  3  120 MB/s   324 MB   o.a.kafka.common.record.MemRecords   โ”‚
โ”‚                                                               โ”‚
โ”‚  โ†’ OrderProcessor.process allocates 57% of total              โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Test plan

  • AllocationProfilerTest passes
  • ./gradlew :argus-cli:test passes
  • Manual test with live JVM

Closes #118

Add argus gcprofile <pid> command that identifies allocation
hotspots by analyzing JFR ObjectAllocationInNewTLAB events:

- GcProfileCommand: triggers JFR recording, waits for duration,
  dumps and analyzes allocation events by stack trace
- AllocationProfiler: parses JFR files, aggregates allocations
  by class.method:line, ranks by total bytes
- Rich TUI output with allocation rate, percentage bars
- i18n entries (en/ko/ja)

Signed-off-by: rlaope <piyrw9754@gmail.com>
@rlaope
Copy link
Copy Markdown
Owner Author

rlaope commented Apr 12, 2026

Merged to master in 47b75d3

@rlaope rlaope closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: GC-aware application profiling correlation

1 participant