Skip to content

Instantly share code, notes, and snippets.

@olivergondza
Created June 14, 2015 19:09
Show Gist options
  • Save olivergondza/648b8d42cce6b173d6bb to your computer and use it in GitHub Desktop.
Save olivergondza/648b8d42cce6b173d6bb to your computer and use it in GitHub Desktop.
dumpling-cli-diff
lr = D.load.threaddump(D.args[0]).threads
rr = D.load.threaddump(D.args[1]).threads
lhs = lr.toSet().collectEntries { [it.nid, it] };
rhs = rr.toSet().collectEntries { [it.nid, it] };
/*
println "New:"
rhs.each { nid, thread ->
if (lhs[nid] == null) {
println thread.header;
}
}
println "Old:"
lhs.each { nid, thread ->
if (rhs[nid] == null) {
println thread.header;
}
}
println "Changed:"
*/
pairs = [:];
lhs.collectEntries { nid, lhs -> [ lhs, rhs[nid] ] }.each { lhs, rhs ->
if (rhs == null) return;
if (!eq(lhs, rhs)) {
pairs[lhs] = rhs;
}
}
lf = File.createTempFile("dumplingDiff", "lhs")
lf << lr.derive(pairs.keySet());
rf = File.createTempFile("dumplingDiff", "rhs")
rf << rr.derive(pairs.values())
p = new ProcessBuilder("vimdiff", lf.getAbsolutePath(), rf.getAbsolutePath()).inheritIO().start()
p.waitFor();
def eq(l, r) {
return l.status == r.status\
&& l.name == r.name\
&& l.daemon == r.daemon\
&& l.priority == r.priority\
&& l.stackTrace == r.stackTrace\
&& l.acquiredLocks == r.acquiredLocks\
&& l.waitingToLock == r.waitingToLock\
&& l.waitingOnLock == r.waitingOnLock
;
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment