Skip to content

Instantly share code, notes, and snippets.

View jmiettinen's full-sized avatar

Jarkko Miettinen jmiettinen

View GitHub Profile
@jmiettinen
jmiettinen / Notes.md
Created December 15, 2016 15:26 — forked from chrisvest/Notes.md
PrintCompilation on different versions of HotSpot VM

About PrintCompilation

This note tries to document the output of PrintCompilation flag in HotSpot VM. It was originally intended to be a reply to a blog post on PrintCompilation from Stephen Colebourne. It's kind of grown too big to fit as a reply, so I'm putting it here.

Written by: Kris Mok rednaxelafx@gmail.com

Most of the contents in this note are based on my reading of HotSpot source code from OpenJDK and experimenting with the VM flags; otheres come from HotSpot mailing lists and other reading materials listed in the "References" section.

This

@jmiettinen
jmiettinen / go_through_snapshots.rb
Last active October 12, 2016 12:36
Given start timestamp and end timestamp, we go through all snapshots between those two until a given block returns true. The block is given a Trx which can then be queried
# BE CAREFUL WITH THE END TIMESTAMP SO THAT YOU DON'T GO TOO FAR INTO THE PAST
# IN CASE THERE'S NO MATCHING SNAPSHOT
def find_snapshot(start_timestamp, end_timestamp = start_timestamp - 1, &block);
end_timestamp = end_timestamp > 0 ? end_timestamp : 0;
earlier = nil;
current_timestamp = start_timestamp;
while current_timestamp > end_timestamp do;
current_ss = FastormDb.database.get_snapshot(current_timestamp);
if block.call(current_ss.begin_trx);
return {:current => current_timestamp, :earlier => earlier };
@jmiettinen
jmiettinen / NestedExceptionTest.java
Created November 20, 2012 09:37
Exceptions with deep causes. JRuby only shows the latest level, i.e. 'Exception on level 8' without any insight into the deeper causes.
public class NestedExceptionTest {
public void throwNestedExceptions(int n) {
if (n > 0) {
try {
throwNestedExceptions(n-1);
} catch (Exception e) {
throw new RuntimeException("Exception on level " + n, e);
}
} else {