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 # Produce memory metrics for run_apply_test
9 source "$(dirname ${0})/stress_test_common"
11 compute_percentiles
() {
12 if [ -z "${1}" ]; then
16 local lines
=$
(cat ${1} |
wc -l)
18 local count
="$(echo "${lines} * $p" | bc -lq | cut -d. -f1)"
19 local bytes
=$
(cat ${1} \
24 echo -n "$((bytes / 1000000))MB "
32 USAGE: $(basename ${0}) dir
34 Produce memory metrics for run_apply_test. This shows the percentiles
35 of the max heap size across all files.
42 if [ ! -d "${dir}" ]; then
43 error
"\"${dir}\" not found" exit 1
46 local metrics_dir
="${dir}/metrics"
47 local metrics
="${dir}/mem_per_file.txt"
49 if [ ! -f "${metrics}" ]; then
50 local metrics_tmp
="${metrics}.tmp"
51 echo "computing usage percentiles for courgette. this may take a while..."
52 find "${metrics_dir}" \
53 |
grep "\.apply_mem$" \
55 local apply_mem
="${i}"
56 local unbz2_mem
="${apply_mem%.apply_mem}.unbz2_mem"
57 local unxz_mem
="${apply_mem%.apply_mem}.unxz_mem"
59 cat "${apply_mem}" "${unbz2_mem}" "${unxz_mem}" \
64 done |
sort -k2 -n > "${metrics_tmp}"
65 mv "${metrics_tmp}" "${metrics}"
68 echo "$(compute_percentiles ${metrics})max heap per file for Courgette" \
71 local metrics_bsdiff
="${dir}/mem_per_file_bsdiff.txt"
73 if [ ! -f "${metrics_bsdiff}" ]; then
74 local metrics_bsdiff_tmp
="${metrics_bsdiff}.tmp"
75 echo "computing usage percentiles for bsdiff. this may take a while..."
76 find "${metrics_dir}" \
77 |
grep "\.bsdiff_mem$" \
79 local bsdiff_mem
="${i}"
80 echo -n "$bsdiff_mem "
86 done |
sort -k2 -n > "${metrics_bsdiff_tmp}"
87 mv "${metrics_bsdiff_tmp}" "${metrics_bsdiff}"
90 echo "$(compute_percentiles ${metrics_bsdiff})max heap per file for bsdiff" \