1#!/usr/local/bin/bash
2
3usage(){
4echo "
5Written by Brian Bushnell
6Last modified June 10, 2016
7
8Description:  Summarizes CrossBlock results.
9Used for testing and validating CrossBlock.
10
11Usage:  summarizecrossblock.sh in=<input file> out=<output file>
12
13Standard parameters:
14in=<file>       A text file of files, or a comma-delimited list of files.
15                Each is a path to results.txt output from Crossblock.
16out=<file>      Output file for the summary.
17overwrite=f     (ow) Set to false to force the program to abort rather than
18                overwrite an existing file.
19
20Processing parameters:
21None yet!
22
23Java Parameters:
24-Xmx            This will set Java's memory usage, overriding autodetection.
25                -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
26                    The max is typically 85% of physical memory.
27-eoom           This flag will cause the process to exit if an out-of-memory
28                exception occurs.  Requires Java 8u92+.
29-da             Disable assertions.
30
31Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
32"
33}
34
35#This block allows symlinked shellscripts to correctly set classpath.
36pushd . > /dev/null
37DIR="${BASH_SOURCE[0]}"
38while [ -h "$DIR" ]; do
39  cd "$(dirname "$DIR")"
40  DIR="$(readlink "$(basename "$DIR")")"
41done
42cd "$(dirname "$DIR")"
43DIR="$(pwd)/"
44popd > /dev/null
45
46#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
47CP="$DIR""current/"
48
49z="-Xmx200m"
50set=0
51
52if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
53	usage
54	exit
55fi
56
57calcXmx () {
58	source "$DIR""/calcmem.sh"
59	setEnvironment
60	parseXmx "$@"
61}
62calcXmx "$@"
63
64summarizecrossblock() {
65	local CMD="java $EA $EOOM $z -cp $CP driver.SummarizeCrossblock $@"
66	echo $CMD >&2
67	eval $CMD
68}
69
70summarizecrossblock "$@"
71