Skip to content

@ProfileHeapAllocation #8

Open
Open
@jeanbisutti

Description

@jeanbisutti
Collaborator

With @ProfileHeapAllocation, heap allocation profiling will be displayed in the console (http://hirt.se/blog/?p=381).

QuickPerf can already profile a test method with Java Flight Recorder. @ProfileHeapAllocation will extract heap allocation profiling data from this recording.

If you would like to have more details on this issue or some help to work on it, please leave a comment.

Activity

Arnaud-Nauwynck

Arnaud-Nauwynck commented on Jan 28, 2020

@Arnaud-Nauwynck

Snippet code to extract data from JFR

            for(Iterator<IItemIterable> iterator = jfrEvents.iterator(); iterator.hasNext(); ) {
                IItemIterable item = iterator.next();
                if (item.hasItems()) {
                    IType<IItem> itemType = item.getType();
                    String itemId = itemType.getIdentifier();
                    System.out.println(itemId + ": count=" + item.getItemCount());
                
                    // jdk.ThreadAllocationStatistics
                    if ("jdk.ThreadAllocationStatistics".equals(itemId)) {
                        for(Iterator<IItem> items = item.iterator(); items.hasNext(); ) {
                            IItem iitem = items.next();
                            // System.out.println(iitem);
                        }
                        
                    }
                    // jdk.ObjectAllocationInNewTLAB
                    if ("jdk.ObjectAllocationInNewTLAB".equals(itemId)) {
                        IMemberAccessor<IMCThread, IItem> eventThreadAcc = JfrAttributes.EVENT_THREAD.getAccessor(itemType);
                        IMemberAccessor<IMCStackTrace, IItem> stackTraceAcc = JfrAttributes.EVENT_STACKTRACE.getAccessor(itemType);
                        
                        for(Iterator<IItem> items = item.iterator(); items.hasNext(); ) {
                            IItem iitem = items.next();
                            IMCThread eventThread = eventThreadAcc.getMember(iitem);
                            IMCStackTrace stackTrace = stackTraceAcc.getMember(iitem);
                            
                            System.out.println(iitem + " eventThread:" + eventThread + " stackTrace:" + stackTrace);
                        }
                        
                    }
                    
                    // jdk.ObjectAllocationOutsideTLAB
                }
            }

self-assigned this
on Apr 28, 2020
added this to the 1.2 milestone on Aug 3, 2020
removed this from the 1.2 milestone on Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

✨ featureNew feature or requestjvmJVM annotations

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Arnaud-Nauwynck@jeanbisutti

      Issue actions

        @ProfileHeapAllocation · Issue #8 · quick-perf/quickperf