From a83e90b56080d1c86f98e66d146f781c19d150c5 Mon Sep 17 00:00:00 2001 From: Tim Buckley Date: Wed, 5 Aug 2015 10:25:00 -0600 Subject: [PATCH] Enable CSV logging output for DStat. Future work toward visualization of DevStack and devstack-gate performance would benefit greatly from the availability of machine-parsable DStat output. This patch outputs an additional logfile to $LOGDIR, `dstat-csv.log`, using DStat's built-in CSV logging functionality. An additional instance of DStat is started during start_dstat that outputs to CSV-formatted text without `--top-cpu-adv` and `-top-io-adv` enabled, as these plugins are currently incompatible with CSV output. To facilitate this, a new `dstat.sh` script is added to $TOP_DIR/tools/ to act as a daemon to manage the two processes. Change-Id: I826c94c35b6a109308b4f132c181ff7a1f63bc7b Depends-On: I534fb1f9356a7948d2fec0aecc7f275e47362a11 --- lib/dstat | 3 +-- tools/dstat.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 tools/dstat.sh diff --git a/lib/dstat b/lib/dstat index f11bfa55c0..fe4790b12d 100644 --- a/lib/dstat +++ b/lib/dstat @@ -19,8 +19,7 @@ set +o xtrace # start_dstat() - Start running processes, including screen function start_dstat { # A better kind of sysstat, with the top process per time slice - DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv" - run_process dstat "dstat $DSTAT_OPTS" + run_process dstat "$TOP_DIR/tools/dstat.sh $LOGDIR" # To enable peakmem_tracker add: # enable_service peakmem_tracker diff --git a/tools/dstat.sh b/tools/dstat.sh new file mode 100755 index 0000000000..6ba4515acf --- /dev/null +++ b/tools/dstat.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# **tools/dstat.sh** - Execute instances of DStat to log system load info +# +# Multiple instances of DStat are executed in order to take advantage of +# incompatible features, particularly CSV output and the "top-cpu-adv" and +# "top-io-adv" flags. +# +# Assumes: +# - dstat command is installed + +# Retreive log directory as argument from calling script. +LOGDIR=$1 + +# Command line arguments for primary DStat process. +DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv" + +# Command-line arguments for secondary background DStat process. +DSTAT_CSV_OPTS="-tcmndrylpg --output $LOGDIR/dstat-csv.log" + +# Execute and background the secondary dstat process and discard its output. +dstat $DSTAT_CSV_OPTS >& /dev/null & + +# Execute and background the primary dstat process, but keep its output in this +# TTY. +dstat $DSTAT_OPTS & + +# Catch any exit signals, making sure to also terminate any child processes. +trap "kill -- -$$" EXIT + +# Keep this script running as long as child dstat processes are alive. +wait