Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ProfileHeapAllocation #8

Open
jeanbisutti opened this issue Jul 4, 2019 · 1 comment
Open

@ProfileHeapAllocation #8

jeanbisutti opened this issue Jul 4, 2019 · 1 comment
Assignees
Labels
jvm JVM annotations ✨ feature New feature or request

Comments

@jeanbisutti
Copy link
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.

@jeanbisutti jeanbisutti added ✨ feature New feature or request jvm JVM annotations labels Jul 7, 2019
@Arnaud-Nauwynck
Copy link

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
                }
            }

@jeanbisutti jeanbisutti self-assigned this Apr 28, 2020
@jeanbisutti jeanbisutti added this to the 1.2 milestone Aug 3, 2020
@jeanbisutti jeanbisutti removed this from the 1.2 milestone Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jvm JVM annotations ✨ feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants