Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit 21376d1

Browse files
committed
bring the contents of rustc-timing-scripts into scripts directory
redirect `process.sh` to read from there
1 parent 2924557 commit 21376d1

11 files changed

+521
-6
lines changed

process.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
if [ -z "$TIMES_DIR" ]; then
44
TIMES_DIR=/home/ncameron/times
55
fi
6-
if [ -z "$SCRIPTS_DIR" ]; then
7-
SCRIPTS_DIR=/home/ncameron/times-scripts
8-
fi
9-
10-
echo TIMES_DIR=$TIMES_DIR
11-
echo SCRIPTS_DIR=$SCRIPTS_DIR
126

137
START=$(pwd)
8+
export SCRIPTS_DIR=${START}/scripts
149
export CARGO_RUSTC_OPTS="-Ztime-passes -Zinput-stats"
1510
export PATH=$RUSTC_DIR/bin:$PATH
1611

12+
echo TIMES_DIR=$TIMES_DIR
13+
echo SCRIPTS_DIR=$SCRIPTS_DIR
14+
1715
# Check if user provided list of directories;
1816
# else process them all.
1917
if [ "$1" != "" ]; then

scripts/LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Nick Cameron
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

scripts/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# rustc-timing
2+
3+
Scripts for timing rustc.
4+
5+
See nrc/rustc-perf for visualisation.
6+
7+
See nrc/benchmarks for more scripts and benchmarks.
8+
9+
See nrc/rustc-timing for the collected data.

scripts/display_totals.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Displays totals for each phase across all crates
2+
3+
import json
4+
import os
5+
import sys
6+
7+
8+
def display(date):
9+
in_name = os.path.join('processed', date + '.json')
10+
11+
with open(in_name) as in_file:
12+
display_totals(json.load(in_file))
13+
14+
def accumulate(dic, key, value):
15+
if key not in dic:
16+
dic[key] = 0.0
17+
18+
dic[key] += value
19+
20+
def display_totals(data):
21+
totals = {}
22+
for crate in data['times']:
23+
accumulate(totals, 'total', crate['total'])
24+
for k in crate['times'].keys():
25+
accumulate(totals, k, crate['times'][k]['time'])
26+
27+
totals = totals.iteritems()
28+
29+
# Sort by time, largest first
30+
totals = sorted(totals, key = lambda (k, v): v, reverse=True)
31+
32+
for (k, v) in totals:
33+
if v >= 0.01:
34+
print k + ':', v
35+
36+
37+
if len(sys.argv) <= 1:
38+
print "Requires filename of data as an argument"
39+
exit(1)
40+
41+
display(sys.argv[1])
42+

scripts/display_tyck.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Displays info about type checking time
2+
3+
import json
4+
import os
5+
import sys
6+
7+
8+
def display(date):
9+
in_name = os.path.join('processed', date + '.json')
10+
11+
with open(in_name) as in_file:
12+
display_data(json.load(in_file))
13+
14+
15+
def display_data(data):
16+
for crate in data['times']:
17+
print "crate:", crate['crate']
18+
print "total time:", crate['total']
19+
tyck = crate['times']['type checking']
20+
if not tyck:
21+
print "no times for type checking"
22+
continue
23+
print "time in type checking: %.3f (%.1f%%; %.2f)"%(tyck['time'], tyck['percent'], tyck['ratio_llvm'])
24+
print
25+
26+
27+
28+
if len(sys.argv) <= 1:
29+
print "Requires filename of data as an argument"
30+
exit(1)
31+
32+
display(sys.argv[1])
33+

scripts/go.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
while :; do
3+
./time.sh
4+
done

scripts/nightly.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Nightly archives are at: http://static.rust-lang.org/dist/index.html
2+
3+
# Runs all the benchmarking for a single downloaded nightly for SRC_DATE
4+
5+
SRC_DATE=2015-05-13
6+
7+
TIMES_DIR=/home/ncameron/times
8+
BENCH_DIR=/home/ncameron/benchmarks
9+
SCRIPTS_DIR=/home/ncameron/times-scripts
10+
11+
mkdir $SRC_DATE
12+
cd $SRC_DATE
13+
14+
echo "downloading nightly for $SRC_DATE"
15+
curl -s http://static.rust-lang.org/dist/$SRC_DATE/rustc-nightly-src.tar.gz | tar -xz
16+
17+
cd rustc-nightly
18+
19+
START=$(pwd)
20+
21+
22+
echo "building"
23+
24+
./configure
25+
make rustc-stage1 -j8
26+
27+
export RUSTFLAGS_STAGE2=-Ztime-passes
28+
export DATE=$SRC_DATE-00-00
29+
30+
for i in 0 1 2
31+
do
32+
echo "building, round $i"
33+
echo "commit 000000" >$TIMES_DIR/raw/rustc--$DATE--$i.log
34+
echo "Author NA" >>$TIMES_DIR/raw/rustc--$DATE--$i.log
35+
echo "Date: $SRC_DATE" >>$TIMES_DIR/raw/rustc--$DATE--$i.log
36+
touch src/librustc_trans/trans/mod.rs
37+
make >>$TIMES_DIR/raw/rustc--$DATE--$i.log
38+
done
39+
40+
echo "processing data"
41+
cd $TIMES_DIR
42+
python $SCRIPTS_DIR/process.py rustc $DATE 3
43+
for i in 0 1 2
44+
do
45+
git add raw/rustc--$DATE--$i.log
46+
git add processed/rustc--$DATE--$i.json
47+
done
48+
49+
echo "benchmarks"
50+
export RUSTC_DIR=$START/x86_64-unknown-linux-gnu/stage2
51+
export RUSTC=$RUSTC_DIR/bin/rustc
52+
export LD_LIBRARY_PATH=$RUSTC_DIR/lib
53+
cd $BENCH_DIR
54+
./process.sh
55+
56+
echo "committing"
57+
cd $TIMES_DIR
58+
git commit -m "Added data for nightly $SRC_DATE"
59+
git push origin master
60+
61+
echo "tidying up"
62+
cd $START
63+
cd ../..
64+
rm -rf $SRC_DATE

0 commit comments

Comments
 (0)