Packages

Ceylan-Myriad, a generic-purpose Erlang toolbox, as an OTP application library here (see http://myriad.esperide.org)

Current section

Files

Jump to
myriad src scripts benchmark-command.sh
Raw

src/scripts/benchmark-command.sh

#!/bin/sh
# Copyright (C) 2010-2018 Olivier Boudeville
#
# Author: Olivier Boudeville [olivier (dot) boudeville (at) esperide (dot) com]
#
# This file is part of the Ceylan-Myriad library.
USAGE="
Usage: $(basename $0) <COMMAND>: returns a mean resource consumption for the specified command."
command="$*"
if [ -z "${command}" ] ; then
echo " Error, no command specified. $USAGE" 1>&2
exit 5
fi
#/usr/bin/time --format "Wall-clock time, in [hours:]minutes:second: %E\nTotal number of CPU-seconds used by the system on behalf of the process (in kernel mode), in seconds.Average total (data+stack+text) memory use of the process, in Kilobytes: %K" ${command}
#/usr/bin/time -f "Wallclock time: %E seconds\nUser time: %Us\nSystem time: %Ss\nMemory: %K KB" ${command} 1>/dev/null
echo "Starting timer"
/usr/bin/time -f "Wallclock time: %E seconds\nUser time: %Us\nSystem time: %Ss" ${command} 1>/dev/null