1#!/bin/sh
2
3if [ -z "$1" ] || [ -z "$2" ]; then
4    echo "usage: $0 SKP_DIRECTORY MULTIPAGE_PDF_PROFILER_EXE" >&2
5    exit 1
6fi
7
8SKP_DIRECTORY="$1"
9MULTIPAGE_PDF_PROFILER_EXE="$2"
10
11printf '"FILE","SKP SIZE (BYTES)","MEMORY USE (MB)"\n' >&2
12for skp in "$SKP_DIRECTORY"/*.skp; do
13    r=$("$MULTIPAGE_PDF_PROFILER_EXE" 0 "$skp")
14    skp_size=$(echo $r | awk '{ print $1 }')
15    mem0=$(echo $r | awk '{ print $2 }')
16    mem1=$("$MULTIPAGE_PDF_PROFILER_EXE" 1 "$skp" | awk '{ print $2 }')
17    printf '"%s",%d,%d\n' $(basename "$skp") $skp_size $(($mem1 - $mem0))
18done
19