Add a reload button to host list.
[chromium-blink-merge.git] / courgette / run_mem_test
blob7f3640aab0f16e1d1f8287d1d4364a28d84f7b8b
1 #!/bin/bash
3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # Collect memory usage on the patches from run_stress_test
9 source "$(dirname ${0})/stress_test_common"
11 main() {
12 if [ $# -lt 1 ]; then
13 cat <<EOF
15 USAGE: $(basename ${0}) dir
17 Collect memory usage on the patches from run_stress_test
19 EOF
20 exit 1
23 local dir="${1}"
24 if [ ! -d "${dir}" ]; then
25 error "\"${dir}\" not found"
26 exit 1
29 local patches_dir="${dir}/patches"
31 find "${patches_dir}" \
32 | grep "\.patch$" \
33 | while read i; do
34 local patch="${i}"
35 local subdir_filename="${patch:$((${#patches_dir} + 1))}"
36 local out_base="${dir}/metrics/${subdir_filename}"
37 mkdir -p "$(dirname ${out_base})"
39 local original="${subdir_filename%.patch}"
40 local applied="${out_base}.applied"
41 local apply_mem="${out_base}.apply_mem"
42 valgrind --tool=massif --massif-out-file="${apply_mem}" courgette -apply \
43 "${original}" "${patch}" "${applied}" &
45 local bz2_patch="${i}.bz2"
46 local unbz2="${out_base}.unbz2"
47 local unbz2_mem="${out_base}.unbz2_mem"
48 valgrind --tool=massif --massif-out-file="${unbz2_mem}" bunzip2 -c \
49 "${bz2_patch}" > "${unbz2}" &
51 local xz_patch="${i}.xz"
52 local unxz="${out_base}.unxz"
53 local unxz_mem="${out_base}.unxz_mem"
54 valgrind --tool=massif --massif-out-file="${unxz_mem}" unxz -c \
55 "${xz_patch}" > "${unxz}" &
57 local bsdiff_patch="${patch%.patch}.bsdiff_patch"
58 local applied_bsdiff="${out_base}.applied_bsdiff"
59 local bsdiff_mem="${out_base}.bsdiff_mem"
60 valgrind --tool=massif --massif-out-file="${bsdiff_mem}" bspatch \
61 "${original}" "${applied_bsdiff}" "${bsdiff_patch}" &
63 wait
64 done
67 main "${@}"