1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Analyze history
|
4 | #
|
5 | # Usage:
|
6 | # soil/history.sh <function name>
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | REPO_ROOT=$(cd $(dirname $0)/.. && pwd)
|
13 |
|
14 | #source $REPO_ROOT/soil/common.sh
|
15 |
|
16 |
|
17 | readonly BASE_DIR=_tmp/soil-history
|
18 |
|
19 | readonly HOST=travis-ci.oilshell.org
|
20 |
|
21 | list() {
|
22 | ### Used the sync'd testdata
|
23 | local dir=${1:-_tmp/github-jobs}
|
24 |
|
25 | # 4 digits
|
26 | ssh travis-ci.oilshell.org 'ls travis-ci.oilshell.org/github-jobs/'
|
27 | }
|
28 |
|
29 | find-wwz() {
|
30 | ### Used the sync'd testdata
|
31 | local dir=${1:-_tmp/github-jobs}
|
32 |
|
33 | mkdir -p $BASE_DIR
|
34 |
|
35 | # 4 digits
|
36 | ssh $HOST \
|
37 | 'cd travis-ci.oilshell.org && find github-jobs/48?? -name benchmarks2.wwz' \
|
38 | | tee $BASE_DIR/listing.txt
|
39 | }
|
40 |
|
41 | sync() {
|
42 | local dir=$HOST
|
43 | rsync \
|
44 | --archive --verbose \
|
45 | --files-from $BASE_DIR/listing.txt \
|
46 | $HOST:$dir/ $BASE_DIR/
|
47 | }
|
48 |
|
49 | list-zip() {
|
50 | unzip -l $BASE_DIR/github-jobs/5000/*.wwz
|
51 | }
|
52 |
|
53 | extract-one() {
|
54 | local id=$1
|
55 | local dir=$BASE_DIR/github-jobs/$id
|
56 | pushd $dir
|
57 |
|
58 | # commit-hash.txt
|
59 | unzip benchmarks2.wwz '_tmp/gc-cachegrind/stage2/*' '_tmp/soil/*' || true
|
60 | popd
|
61 | }
|
62 |
|
63 | extract-all() {
|
64 | for dir in $BASE_DIR/github-jobs/48??; do
|
65 | local id=$(basename $dir)
|
66 | extract-one $id
|
67 | done
|
68 | }
|
69 |
|
70 | show-all() {
|
71 | #local pat='mut+alloc+free+gc'
|
72 | local pat='bumpleak'
|
73 |
|
74 | grep "$pat" \
|
75 | $BASE_DIR/github-jobs/????/_tmp/gc-cachegrind/stage2/ex.compute-fib.tsv
|
76 | }
|
77 |
|
78 | "$@"
|