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

[BTRACE-34] Time spent in garbage collection last X minutes #45

Closed
jbachorik opened this issue Aug 28, 2014 · 8 comments
Closed

[BTRACE-34] Time spent in garbage collection last X minutes #45

jbachorik opened this issue Aug 28, 2014 · 8 comments

Comments

@jbachorik
Copy link
Collaborator

[reporter="joachimhskeie", created="Tue, 26 Jan 2010 20:34:41 +0100", resolved="Fri, 23 Apr 2010 13:14:08 +0200"]

Reporting memory usage is one part of analyzing memory issues. Linked with situations like memory leaks is increased time spent in garbage collection. As the problem increases GC is all the application spends time on.

This can be implemented in more than one way, one being probing the GC MXBean every ten or fifteen seconds, to be able to calculate the total time in percent spent in GC during the last, say 15 or 20 minuttes. As far as I know the JVM will attempt to spend about one percent of its time performing GC.

I assume some code needs to go into BTraceRuntime, and some into a BTrace Script.

I might attach one possible solution if I can fins the time.

@jbachorik jbachorik added this to the release-1.2 milestone Aug 28, 2014
@jbachorik
Copy link
Collaborator Author

[author="joachimhskeie", created="Wed, 27 Jan 2010 00:42:19 +0100"]

I have made some changes to BTraceUtils and BTraceRuntime to be able to get hold of this data for the BTrace Script.

Attaching HG Diff file with the following changes:

  • Added GarbageCollectionMXBean to BTraceRuntime
  • Added methods to Utils and Runtime to return the total time in GC since application startup
  • Added a few methods to be able to work better with the Deque

Attaching BTrace script file with the following functionality:

  • Creation of a Deque
  • Every 15 seconds the time spent in GC is collected and pushed to the very end of the Deque
  • Once the size of the Deque reaches 60 (15 minutes), the first element is subtracted from the second element of the queue, divided with the time between the first and last element
  • The very first element is removed from the deque

I havent debugged this extensively, and some exception handling might be needed when working with the deque, but overall I think this should work.

I will leave it to you to decide if this should be part of a BTrace Script like proposed, or if more logic should be placed inside BTraceRuntime and BTraceUtils.

This originated from http://jira.haagen.name/browse/EUREKAJ-33

@jbachorik
Copy link
Collaborator Author

[author="jbachorik", created="Fri, 19 Feb 2010 13:27:14 +0100"]

The patch looks good.
Unfortunately, as I've recently learned the hard way, I will need you to sign a SCA (http://www.sun.com/software/opensource/contributor_agreement.jsp) before being (legally) able to apply any of yours patches.

@jbachorik
Copy link
Collaborator Author

[author="joachimhskeie", created="Fri, 19 Feb 2010 20:11:41 +0100"]

Hello,

Do you have an email address where I can email the signed SCA to ?

@jbachorik
Copy link
Collaborator Author

[author="jbachorik", created="Wed, 24 Feb 2010 12:02:31 +0100"]

Unfortunately, due to pending acquisition there is no new SCA available yet and the old one has been rendered invalid (so it is not possible to accept any contribution till a new SCA and the related process is created) ((

@jbachorik
Copy link
Collaborator Author

[author="joachimhskeie", created="Fri, 9 Apr 2010 07:21:05 +0200"]

Hello, is there any advances regarding a new SCA now that the Oracle acquisition is final ?

@jbachorik
Copy link
Collaborator Author

[author="jbachorik", created="Wed, 14 Apr 2010 11:48:05 +0200"]

Well, the situation is still misty, but it seems that the NetBeans ACA will be fine even for BTrace. Check out this site http://wiki.netbeans.org/FaqHowDoIFileACA to fill out and process the request.

@jbachorik
Copy link
Collaborator Author

[author="joachimhskeie", created="Fri, 16 Apr 2010 23:13:58 +0200"]

Hello again, i have been added to the SCA contributers list: https://sca.dev.java.net/CA_signatories.htm

@jbachorik
Copy link
Collaborator Author

[author="jbachorik", created="Fri, 23 Apr 2010 13:14:08 +0200"]

Applying joachims changes:
http://kenai.com/projects/btrace/sources/hg/revision/292
http://kenai.com/projects/btrace/sources/hg/revision/293

I split the patch to to commits - one for GC MBean and one for advanced Deque functionality.
I left out the "dequeHasAtLeastElements(Deque deque, int expectedElements)" method which can be replaced by calling "if (size(deque) >= expectedElements)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant