Created
December 26, 2013 00:26
-
-
Save spullara/8128258 to your computer and use it in GitHub Desktop.
Quick and dirty memory use estimator for benchmarks. Run with -verbosegc and pipe it to this command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spullara; | |
import java.io.BufferedReader; | |
import java.io.FileNotFoundException; | |
import java.io.InputStreamReader; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class GCParser { | |
public static void main(String[] args) throws FileNotFoundException { | |
Pattern memory = Pattern.compile("([0-9]+)K->([0-9]+)K"); | |
long total = new BufferedReader(new InputStreamReader(System.in)).lines().mapToLong(line -> { | |
Matcher m = memory.matcher(line); | |
if (m.find()) { | |
long start = Long.parseLong(m.group(1)); | |
long end = Long.parseLong(m.group(2)); | |
return start - end; | |
} | |
return 0; | |
}).sum(); | |
System.out.println(total); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment