aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/profiling/latency_profile
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-12-15 07:35:42 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-12-15 09:18:16 -0800
commit0607671fe53661b5de0d375088d8de6dd2ffbd90 (patch)
tree256811b7cbdf6f2f2c7db3e98957dd904da6691e /tools/profiling/latency_profile
parentfc51234af33972e001af70393bb649b647456d06 (diff)
Tweak run_latency_profile.sh to run better on Jenkins
- More robustly run processes in the background - Detect and use pypy if available - Add a --latency_profile flag to control whether to run the latency profiling stuff
Diffstat (limited to 'tools/profiling/latency_profile')
-rwxr-xr-xtools/profiling/latency_profile/run_latency_profile.sh30
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/profiling/latency_profile/run_latency_profile.sh b/tools/profiling/latency_profile/run_latency_profile.sh
index 41686be560..64c3e58fcb 100755
--- a/tools/profiling/latency_profile/run_latency_profile.sh
+++ b/tools/profiling/latency_profile/run_latency_profile.sh
@@ -11,6 +11,17 @@ make CONFIG=basicprof -j$CPUS $BINS
mkdir -p reports
+# try to use pypy for generating reports
+# each trace dumps 7-8gig of text to disk, and processing this into a report is
+# heavyweight - so any speed boost is worthwhile
+# TODO(ctiller): consider rewriting report generation in C++ for performance
+if which pypy >/dev/null; then
+ PYTHON=pypy
+else
+ PYTHON=python2.7
+fi
+
+# start processes, interleaving report index generation
echo '<html><head></head><body>' > reports/index.html
for bin in $BINS
do
@@ -18,12 +29,27 @@ do
mv latency_trace.txt $bin.trace
echo "<a href='$bin.txt'>$bin</a><br/>" >> reports/index.html
done
+pids=""
+# generate report pages... this will take some time
+# run them in parallel: they take 1 cpu each
for bin in $BINS
do
- tools/profiling/latency_profile/profile_analyzer.py \
+ $PYTHON tools/profiling/latency_profile/profile_analyzer.py \
--source=$bin.trace --fmt=simple > reports/$bin.txt &
+ pids+=" $!"
done
echo '</body></html>' >> reports/index.html
-wait
+# make sure we kill the report generation if something goes wrong
+trap "kill $pids || true" 0
+# finally, wait for the background report generation to finish
+for pid in $pids
+do
+ if wait $pid
+ then
+ echo "Finished $pid"
+ else
+ exit 1
+ fi
+done