diff options
author | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 19:36:08 +0000 |
---|---|---|
committer | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 19:36:08 +0000 |
commit | 80092a3286ea06759d0cd7a2b040ae2f19a50e55 (patch) | |
tree | 7026fdcbd9415007843c3e2a9a15382022f905c2 /courgette/analyze_mem_test | |
parent | 1819dc9a76cc6a6e559b6c900b2fa7e34f9dc430 (diff) | |
download | chromium_src-80092a3286ea06759d0cd7a2b040ae2f19a50e55.zip chromium_src-80092a3286ea06759d0cd7a2b040ae2f19a50e55.tar.gz chromium_src-80092a3286ea06759d0cd7a2b040ae2f19a50e55.tar.bz2 |
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
Diffstat (limited to 'courgette/analyze_mem_test')
-rwxr-xr-x | courgette/analyze_mem_test | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/courgette/analyze_mem_test b/courgette/analyze_mem_test new file mode 100755 index 0000000..9470fa2 --- /dev/null +++ b/courgette/analyze_mem_test @@ -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 "${@}" |