From e28051566cb3fdfa5431088645afc0b78868038b Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Feb 29 2020 13:18:48 +0000 Subject: Add automation for trace analysis. Create trace_analysis.sh to automate some of the more rote aspects of generating files from the trace. --- diff --git a/block_size_rss.c b/block_size_rss.c index e75c30e..3ff0d55 100644 --- a/block_size_rss.c +++ b/block_size_rss.c @@ -113,11 +113,17 @@ main (int argc, char **argv) struct stat statb; unsigned char *data; + if (argc < 2) + { + printf ("%s: \n", argv[0]); + exit (1); + } + fd = open(argv[1], O_RDONLY); if (fd < 0) { - fprintf(stderr, "Unable to open %s for reading\n", argv[1]); - perror("The error was"); + perror("open"); + fprintf(stderr, "%s: Unable to open %s for reading\n", argv[0], argv[1]); exit(1); } fstat (fd, &statb); diff --git a/hist.sh b/hist.sh index 18ecd70..d2d3e9e 100755 --- a/hist.sh +++ b/hist.sh @@ -27,5 +27,4 @@ # Usage: # ./hist.sh ./xxw1_allos.log > ./xxw1_binned_allocs.log set -e -set -x perl -lne '$h{$_}++; END{for $n (sort keys %h) {print "$n\t$h{$n}"}}' $@ diff --git a/trace_analysis.sh b/trace_analysis.sh new file mode 100755 index 0000000..c2723cd --- /dev/null +++ b/trace_analysis.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Automation for analysis of the trace file. + +# Copyright (C) 2020 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +set -e +set -x + +function usage() +{ + echo "$0: " + exit 1 +} + +if [ "$#" -lt 2 ]; then + usage +fi +if [ -z "$1" ]; then + usage +fi +if [ -z "$2" ]; then + usage +fi + +echo "Running analysis:" +echo "Trace file: \"$1\"" +echo "Short name: \"$2\"" + +# We run all pre-processing before simulation. +if [ ! -e "$2.wl" ]; then + echo -n "Converting trace to workload... " + trace2wl "$2.wl" "$1" >& "$2_run_convert.log" + echo "OK" +fi +if [ ! -e "$2_allocs.log" ]; then + echo -n "Generating allocation histogram... " + trace_dump "$1" >& "$2_allocs.log" + hist.sh "$2_allocs.log" >& "$2_binned_allocs.log" + echo "OK" +fi +if [ ! -e "$2_block_rss.log" ]; then + echo -n "Generating block size RSS estimates... " + block_size_rss "$1" > "$2_block_rss.log" + echo "OK" +fi +if [ ! -e "$2_statistics.txt" ]; then + echo -n "Generating simple statistics... " + statistics "$1" > "$2_statistics.txt" + echo "OK" +fi + +# If the summary file is not present then we rerun the simulator +# to generate the summary again. +if [ ! -e "$2_summary.log" ]; then + trace_run "$2.wl" \ + "$2_VmSize.log" \ + "$2_VmRSS.log" \ + "$2_ideal_RSS.log" > "$2_summary.txt" +fi + +# TODO: +# - Downsample below 10MiB for analysis in octave. +# - Auto-generate trace_plot.m from default trace_plot.m. + +# Success +echo 0