This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Usage: script/profile FILE_A FILE_B
3+ # Builds and runs semantic on the given files with profiling enabled.
4+
5+ set -e
6+
7+ HEAD_SHA=$( git rev-parse --short HEAD)
8+ CURRENT_BRANCH=$( git symbolic-ref HEAD 2> /dev/null | awk -F/ {' print $NF' })
9+
10+ PROJECT_DIR=" $( dirname $0 ) /.."
11+ PROFILES_DIR=" $PROJECT_DIR /profiles"
12+ TODAY=" $( date " +%Y-%m-%d" ) "
13+ NOW=$( date " +%H_%M_%S" )
14+ PROFILE_DIR=" $PROFILES_DIR /$TODAY /$NOW -$CURRENT_BRANCH -$HEAD_SHA /"
15+ OUTFILE=" $PROFILE_DIR /profile.out.log"
16+ ERRFILE=" $PROFILE_DIR /profile.err.log"
17+
18+ cabal new-build
19+
20+ mkdir -p " $PROFILE_DIR "
21+
22+ # NB: Do not try and use -N, it doesn't work and defaults to -N1.
23+ cores=$( sysctl -n machdep.cpu.core_count || echo 4)
24+ cabal new-run semantic -- +RTS -sstderr -N$(( cores * 2 )) -A8m -n2m -p -s -h -i0.1 -L1000 -xt -RTS $@ > " $OUTFILE " 2> " $ERRFILE "
25+
26+ profiteur semantic.prof || true
27+
28+ hp2pretty semantic.hp
29+
30+ for f in " $PROJECT_DIR /" semantic.* ; do
31+ if [ " $f " != " $PROJECT_DIR /" semantic.cabal ]; then
32+ mv " $f " " $PROFILE_DIR "
33+ fi
34+ done
35+
36+ (>&2 echo " branch: $CURRENT_BRANCH ($HEAD_SHA )" )
37+
38+ open " $PROFILE_DIR "
You can’t perform that action at this time.
0 commit comments