forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added time and memory metrics and xz compression tests
BUG=266021,205187,266028 Review URL: https://chromiumcodereview.appspot.com/22313007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217611 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
paulgazz@chromium.org
committed
Aug 14, 2013
1 parent
1819dc9
commit 80092a3
Showing
4 changed files
with
257 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2013 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# Produce memory metrics for run_apply_test | ||
|
||
error() { | ||
echo "error: ${@}" >&2 | ||
} | ||
|
||
compute_percentiles() { | ||
if [ -z "${1}" ]; then | ||
return; | ||
fi | ||
local pctls=".5 .9 1" | ||
local lines=$(cat ${1} | wc -l) | ||
for p in $pctls; do | ||
local count="$(echo "${lines} * $p" | bc -lq | cut -d. -f1)" | ||
local bytes=$(cat ${1} \ | ||
| cut -d' ' -f2 \ | ||
| sort -n \ | ||
| head -n$count \ | ||
| tail -n1) | ||
echo -n "$((bytes / 1000000))MB " | ||
done | ||
} | ||
|
||
main() { | ||
if [ $# -lt 1 ]; then | ||
cat <<EOF | ||
USAGE: $(basename ${0}) dir | ||
Produce memory metrics for run_apply_test. This shows the percentiles | ||
of the max heap size across all files. | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
local dir="${1}" | ||
if [ ! -d "${dir}" ]; then | ||
error "\"${dir}\" not found" exit 1 | ||
fi | ||
|
||
local metrics_dir="${dir}/metrics" | ||
local metrics="${dir}/mem_per_file.txt" | ||
|
||
if [ ! -f "${metrics}" ]; then | ||
local metrics_tmp="${metrics}.tmp" | ||
echo "computing usage percentiles for courgette. this may take a while..." | ||
find "${metrics_dir}" \ | ||
| grep "\.apply_mem$" \ | ||
| while read i; do | ||
local apply_mem="${i}" | ||
local unbz2_mem="${apply_mem%.apply_mem}.unbz2_mem" | ||
local unxz_mem="${apply_mem%.apply_mem}.unxz_mem" | ||
echo -n "$apply_mem " | ||
cat "${apply_mem}" "${unbz2_mem}" "${unxz_mem}" \ | ||
| grep "mem_heap_B" \ | ||
| cut -d= -f2 \ | ||
| sort -nr \ | ||
| head -n1 | ||
done | sort -k2 -n > "${metrics_tmp}" | ||
mv "${metrics_tmp}" "${metrics}" | ||
fi | ||
|
||
echo "$(compute_percentiles ${metrics})max heap per file for Courgette" \ | ||
"(50th 90th 100th)" | ||
|
||
local metrics_bsdiff="${dir}/mem_per_file_bsdiff.txt" | ||
|
||
if [ ! -f "${metrics_bsdiff}" ]; then | ||
local metrics_bsdiff_tmp="${metrics_bsdiff}.tmp" | ||
echo "computing usage percentiles for bsdiff. this may take a while..." | ||
find "${metrics_dir}" \ | ||
| grep "\.bsdiff_mem$" \ | ||
| while read i; do | ||
local bsdiff_mem="${i}" | ||
echo -n "$bsdiff_mem " | ||
cat $bsdiff_mem \ | ||
| grep "mem_heap_B" \ | ||
| cut -d= -f2 \ | ||
| sort -nr \ | ||
| head -n1 | ||
done | sort -k2 -n > "${metrics_bsdiff_tmp}" | ||
mv "${metrics_bsdiff_tmp}" "${metrics_bsdiff}" | ||
fi | ||
|
||
echo "$(compute_percentiles ${metrics_bsdiff})max heap per file for bsdiff" \ | ||
"(50th 90th 100th)" | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2013 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# Collect memory usage on the patches from run_stress_test | ||
|
||
error() { | ||
echo "error: ${@}" >&2 | ||
} | ||
|
||
main() { | ||
if [ $# -lt 1 ]; then | ||
cat <<EOF | ||
USAGE: $(basename ${0}) dir | ||
Collect memory usage on the patches from run_stress_test | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
local dir="${1}" | ||
if [ ! -d "${dir}" ]; then | ||
error "\"${dir}\" not found" | ||
exit 1 | ||
fi | ||
|
||
local patches_dir="${dir}/patches" | ||
|
||
find "${patches_dir}" \ | ||
| grep "\.patch$" \ | ||
| while read i; do | ||
local patch="${i}" | ||
local subdir_filename="${patch:$((${#patches_dir} + 1))}" | ||
local out_base="${dir}/metrics/${subdir_filename}" | ||
mkdir -p "$(dirname ${out_base})" | ||
|
||
local original="${subdir_filename%.patch}" | ||
local applied="${out_base}.applied" | ||
local apply_mem="${out_base}.apply_mem" | ||
valgrind --tool=massif --massif-out-file="${apply_mem}" courgette -apply \ | ||
"${original}" "${patch}" "${applied}" & | ||
|
||
local bz2_patch="${i}.bz2" | ||
local unbz2="${out_base}.unbz2" | ||
local unbz2_mem="${out_base}.unbz2_mem" | ||
valgrind --tool=massif --massif-out-file="${unbz2_mem}" bunzip2 -c \ | ||
"${bz2_patch}" > "${unbz2}" & | ||
|
||
local xz_patch="${i}.xz" | ||
local unxz="${out_base}.unxz" | ||
local unxz_mem="${out_base}.unxz_mem" | ||
valgrind --tool=massif --massif-out-file="${unxz_mem}" unxz -c \ | ||
"${xz_patch}" > "${unxz}" & | ||
|
||
local bsdiff_patch="${patch%.patch}.bsdiff_patch" | ||
local applied_bsdiff="${out_base}.applied_bsdiff" | ||
local bsdiff_mem="${out_base}.bsdiff_mem" | ||
valgrind --tool=massif --massif-out-file="${bsdiff_mem}" bspatch \ | ||
"${original}" "${applied_bsdiff}" "${bsdiff_patch}" & | ||
|
||
wait | ||
done | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters