1#!/usr/local/bin/bash
2
3usage(){
4echo "
5Written by Brian Bushnell
6Last modified March 15, 2016
7
8Description:  Reformats output from a script.
9Made for generating the BBMerge paper data.
10
11Usage:  processfrags.sh <file>
12
13Processing parameters:
14None yet!
15
16Java Parameters:
17-Xmx            This will set Java's memory usage, overriding autodetection.
18                -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will
19                specify 200 megs. The max is typically 85% of physical memory.
20-eoom           This flag will cause the process to exit if an out-of-memory
21                exception occurs.  Requires Java 8u92+.
22-da             Disable assertions.
23
24Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
25"
26}
27
28#This block allows symlinked shellscripts to correctly set classpath.
29pushd . > /dev/null
30DIR="${BASH_SOURCE[0]}"
31while [ -h "$DIR" ]; do
32  cd "$(dirname "$DIR")"
33  DIR="$(readlink "$(basename "$DIR")")"
34done
35cd "$(dirname "$DIR")"
36DIR="$(pwd)/"
37popd > /dev/null
38
39#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
40CP="$DIR""current/"
41
42z="-Xmx100m"
43z2="-Xms100m"
44set=0
45
46if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
47	usage
48	exit
49fi
50
51calcXmx () {
52	source "$DIR""/calcmem.sh"
53	setEnvironment
54	parseXmx "$@"
55}
56calcXmx "$@"
57
58processfrags() {
59	local CMD="java $EA $EOOM $z -cp $CP driver.ProcessFragMerging $@"
60	echo $CMD >&2
61	eval $CMD
62}
63
64processfrags "$@"
65