[go: nahoru, domu]

blob: 60b1a6472b8044ad53366714ada81d12726d57df [file] [log] [blame]
paulgazz@chromium.org80092a32013-08-14 19:36:081#!/bin/bash
2
Avi Drissman0ff8a7e2022-09-13 18:35:423# Copyright 2013 The Chromium Authors
paulgazz@chromium.org80092a32013-08-14 19:36:084# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Collect memory usage on the patches from run_stress_test
8
dgarrett@chromium.orgd4851462013-08-28 23:12:589source "$(dirname ${0})/stress_test_common"
paulgazz@chromium.org80092a32013-08-14 19:36:0810
11main() {
12 if [ $# -lt 1 ]; then
13 cat <<EOF
14
15USAGE: $(basename ${0}) dir
16
17Collect memory usage on the patches from run_stress_test
18
19EOF
20 exit 1
21 fi
22
23 local dir="${1}"
24 if [ ! -d "${dir}" ]; then
25 error "\"${dir}\" not found"
26 exit 1
27 fi
28
29 local patches_dir="${dir}/patches"
30
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})"
38
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}" &
44
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}" &
50
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}" &
56
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}" &
62
63 wait
64 done
65}
66
67main "${@}"